AWS Auto Scaling and Workload Security
You can set up automatic protection in Workload Security for new instances created by AWS Auto Scaling.
Each instance created by Auto Scaling will need to have a Deep Security Agent installed on it. There are two ways that you can do this: you can include a pre-installed agent in the EC2 instance used to create the AMI, or you install the agent by including a deployment script in the launch configuration for the AMI. There are pros and cons for each option:
- If you include a pre-installed agent, instances will spin up more quickly because there is no need to download and install the agent software. The downside is that the agent software might not be the latest. To work around this issue, you can enable the upgrade on activation feature.
- If you use a deployment script to install the agent, it will always get the latest version of the agent software from Workload Security.
If you have an EC2 instance already configured with a Deep Security Agent, you can use that instance to create the AMI for Auto Scaling. Before creating the AMI, you must deactivate the agent on the EC2 instance and stop the instance:
Each new EC2 instance created by Auto Scaling needs to have its agent activated and a policy applied to it, if it doesn’t have one already. There are two ways to do this:
- You can create a deployment script that activates the agent and optionally applies a policy. Then add the deployment script to the AWS launch configuration so that it is run when a new instance is created. For instructions, see the "Install the Agent with a deployment script" section below, but omit the section of the deployment script that gets and installs the agent. You will only need the dsa_control -a section of the script.
For the deployment scripts to work, agent-initiated communication must be enabled in Workload Security. For details on this setting, see Activate and protect agents using agent-initiated activation and communication
- You can set up an event-based task in Workload Security that will activate the agent and optionally apply a policy when an instance it launched and the "Computer Created (By System)" event occurs.
Workload Security provides the ability to generate customized deployment scripts that you can run when EC2 instances are created. If the EC2 instance does not contain a pre-installed agent, the deployment script should install the agent, activate it, apply a policy, and optionally assign the machine to a computer group and relay group.
In order for the deployment script to work:
- You must create AMIs from machines that are stopped.
- Agent-initiated communication must be enabled in Workload Security. For details on this setting, see Activate and protect agents using agent-initiated activation and communication.
To set up automatic protection for instances using a deployment script:
- Sign in to the Workload Security console.
- From the Support menu in the top right-hand corner, select Deployment Scripts.
- Select your platform.
- Select Activate Agent automatically after installation.
- Select the appropriate Security Policy, Computer Group and Relay Group.
- Click Copy to Clipboard.
- Go to the AWS launch configuration, expand Advanced Details and paste the deployment script into User Data.
If you are encountering issues getting the PowerShell deployment script to run on a Microsoft Windows-based AMI, the issues may be caused by creating the AMI from a running instance. AWS supports creating AMIs from running instances, but this option disables ALL of the Ec2Config tasks that would run at start time on any instance created from the AMI. This behavior prevents the instance from attempting to run the PowerShell script.
After you have added an AWS Account in Workload Security, instances that no longer exist in AWS as a result of Auto Scaling will be automatically removed from Workload Security.
See About adding AWS accounts for details on adding an AWS account.