Amazon Web Services (AWS) Elastic Beanstalk is a service designed to allow customers to deploy and manage applications that are running in AWS without needing to configure the underlying infrastructure that the applications run on.
Alert Logic® fully supports agent deployment on Elastic Beanstalk. As with traditional EC2 instances, you can install the Alert Logic agent via SSH and command line, but also have the ability to add the Alert Logic agent into your Elastic Beanstalk application bundle. This allows for the auto-deployment of the Alert Logic agent in your Elastic Beanstalk deployment. By following the process below, you can automate installation in your existing deployment and ensure successful application bundle updates.
Solution
The following configuration steps are defined using config files within a directory called .ebextension that needs to be added to the application bundle. By adding these installation steps to configuration files within the .ebextension directory, Alert Logic agents can be deployed into Elastic Beanstalk environments.
Note: Use caution when creating or editing these files. The service is very sensitive to MSDOS/Windows line breaks. If using YAML, remember that tabs are considered invalid characters and will cause the environment to fail. Mac users must use the command-line "zip" and not the Finder-integrated "Compress" option.
The following examples demonstrate how to install and provision the Alert Logic agent for both Linux and Windows instances deployed in your AWS Elastic Beanstalk environment.
Linux Deployment
In this example, the standard Java with Tomcat sample application (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/samples/java-tomcat-v1.zip) is used. The steps are identical for other application bundles.
- Unzip the application bundle into a directory.
- If the base directory does not already contain a .ebextension directory, create one.
Note: The period at the beginning of the directory name indicates that this directory is meant to be hidden.
- Call the configuration options within the .ebextension directory. The configuration options are defined in .config files and must be either JSON or YAML. The name of the file does not matter, as long as the file extension .config is used. The example below uses "alagent.config".
packages: rpm: alagent: https://scc.alertlogic.net/software/al-agent-LATEST-1.x86_64.rpm commands: 01ProvisionAgent: command: /etc/init.d/al-agent provision --inst-type host test: '[ ! -e /var/alertlogic/lib/agent/etc/host_uuid ]' 02StartAgent: command: /etc/init.d/al-agent start test: '[ ! $(pidof al-agent) ]'
- Call the configuration options within the .ebextension directory. The configuration options are defined in .config files and must be either JSON or YAML. The name of the file does not matter, as long as the file extension .config is used. The example below uses "alagent.config".
- Once you've added the config file, create a new application bundle, as the command line zip tool will not include hidden directories unless explicitly directed. Make sure your output includes the .config file you specified. Utilize the following example as a guide:
AL-REM-rholland:java-tomcat-v1 6 rholland$ zip -r javeExampleWithAgent.zip * .ebextensions/*
adding: META-INF/ (stored 0%)
adding: META-INF/LICENSE.txt (deflated 65%)
adding: META-INF/MANIFEST.MF (stored 0%)
adding: META-INF/NOTICE.txt (deflated 10%)
adding: WEB-INF/ (stored 0%)
adding: WEB-INF/web.xml (deflated 58%)
adding: cron.yaml (deflated 21%)
adding: index.jsp (deflated 62%)
adding: javatest.zip (stored 0%)
adding: robots.txt (stored 0%)
adding: scheduled.jsp (deflated 50%)
adding: .ebextensions/alagent.config (deflated 34%)
adding: .ebextentions/logging.config (deflated 52%)
You can now upload and deploy the new version of the application bundle, which will download and provision the agent.
Windows Deployment
In this example, the standard IIS-DotNet sample application is used. The steps are identical for other application bundles.
- Unzip the application bundle into a directory.
- If the base directory does not already contain a .ebextension directory, create one.
Note: The period at the beginning of the directory name indicates that this directory is meant to be hidden. - Call the configuration options within this directory. The name of the file does not matter, as long as the file extension .config is used. The example below uses "alagent.config".
files: "C:\\al_agent.msi": source: https://scc.alertlogic.net/software/al_agent-LATEST.msi
command: "msiexec /i c:\\al_agent.msi PROV_ONLY=host"
waitAfterCompeltion: 120
test: cmd /c "IF EXIST C:\\Progra~2\\AlertLogic\\agent\\al-agent.exe (exit 1) ELSE (exit 0)"
services:
windows:
"al_agent":
enabled: true
ensureRunning: true - Once you've added the config file, create a new application bundle.
You can now upload and deploy the new version of the application bundle, which will download and provision the agent.
Comments
1 comment
In care you are lost on the config file here is the gist
https://gist.github.com/shashikantj/de2038dc5ab674ffb8f086ede19e47d5
Please sign in to leave a comment.