This document will provide step-by-step instructions on how to enable Threat Stack to be installed and deployed automatically on instances in Amazon Elastic Beanstalk (EB) environments.
Create a Custom AMI
- Follow Steps 1 through 9 of these instructions to create an EB Application running the platform version, EC2 instance architecture and region you plan to use for the base AMI:
- In step 10 customize the instance by following steps 1 and 2 in the "Add New Server" dialog in Threat Stack to add Threat Stack repo info and the Threat Stack PGP to the instance. These instructions will vary depending on the instance platform (e.g. RHEL, Amazon Linux, Ubuntu).
- Complete Steps 12 and 13.
- Save the AMI ID for use in a later step.
Prepare the Source Bundle
Whether you are deploying Threat Stack as part of another app, or stand alone, you will need to prepare a source bundle as a single .zip or .war file.
- First create a directory on your local hard drive to contain the application
- At the top level of this directory, create a sub-directory called ".ebextensions"
- Within this sub-directory, create a file called with a ".config" extension to contain the threatstack configuration (e.g. "threatstack.config")
- The .config file should contain the commands that will be executed once a new EB environment is created using the custom AMI, including:
- Downloading the latest Threat Stack package
- Deploying and registering the Threat Stack agent
- Here is a sample .config file for CentOS/RHEL and Amazon Linux:
Note: Use spaces instead of tabs to indent. Preserve indent levels shown above.
Create an Elastic Beanstalk Application
Navigate to the Elastic Beanstalk Services page and click "Get Started"
Enter the "Application Name" and choose a "Platform" that matches the platform for the Custom AMI you created and plan to use. Select "Upload your code" and select the source bundle you created.
Click "Configure more options"
- Under Environment settings: Enter a name for your environment.
- Under Instances: Enter the AMI ID of your custom AMI.
- Under Security: Enter the Virtual Machine Key Pair you used when creating the custom AMI.
- Enter any other applicable configurations.
Click "Create App"
After your application has succesfully launched you should see this:
You should also see the instance running on the EC2 dashboard:
After a few minutes you should also see a new server on the Threat Stack server page: