Install PHP Agent in AWS Beanstalk
The following instructions will guide you through the installation of PHP Agent in AWS Beanstalk environment.
- Download PHP agent from the Site24x7 client
- Extract the agent, this will create a directory called zpa
- Create a file called zpa.config and copy the below given script into it
-
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/apminstall.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
APM_KEY=$(/opt/elasticbeanstalk/bin/get-config environment -k MONITORING_APM_LICENSE 2>&1)
APM_NAME=$(/opt/elasticbeanstalk/bin/get-config environment -k MONITORING_APM_NAME 2>&1)
cd /opt/
rm agent_php.zip -f
wget -O agent_php.zip https://staticdownloads.site24x7.com/apminsight/agents/agent_php.zip
unzip -o agent_php.zip
cd /opt/zpa/bin
rm instance.out
sh run.sh stop
sh configure.sh ${APM_KEY} ${APM_NAME}
sh run.sh startcommands:
install_apm:
command:
"bash /opt/elasticbeanstalk/hooks/appdeploy/post/apminstall.sh" - Copy zpa.config file in .ebextensions directory
- Edit your EBS application configuration and add 2 keys, MONITORING_APM_LICENSE (mandatory, give your site24x7 license key) and MONITORING_APM_NAME (optional-if not given application will appear under PHP-Application name in APM dashboard) as shown in the following image
- Restart application server from Action menu on the right side of your beanstalk console.