Auto Scaling helps you ensure that you have the correct number of Amazon EC2 instances available to handle the load for your application.
Steps to configure auto-scaling:
- Create a Launch Configuration:
aws autoscaling create-launch-configuration --launch-configuration-name my-launch-config --image-id ami-0abcdef1234567890 --instance-type t2.micro --key-name MyKeyPair --security-groups sg-abcdef123
2. Create an Auto Scaling Group:
aws autoscaling create-auto-scaling-group --auto-scaling-group-name my-asg --launch-configuration-name my-launch-config --min-size 1 --max-size 5 --desired-capacity 2 --vpc-zone-identifier subnet-6e7f829e
3. Attach a scaling policy:
aws autoscaling put-scaling-policy --auto-scaling-group-name my-asg --policy-name scale-out --scaling-adjustment 1 --adjustment-type ChangeInCapacity