...

/

Scaling: Add an Auto Scaling Group

Scaling: Add an Auto Scaling Group

Objective

  • Replace explicit EC2 instances with Auto Scaling.

Steps

  • Add an Auto Scaling Group.

Thus far, we have created our two EC2 instances explicitly. Doing this means that we need to update the CloudFormation template and do an infrastructure deployment just to add, remove, or replace an instance.

In this section, we’ll replace our two EC2 instances with an auto scaling group (ASG). We can then easily increase or decrease the number of hosts running our application by simply changing the value of desired instances for our ASG. In addition, we will configure our ASG to place our instances evenly across our two availability zones. This ensures that if one availability zone has an outage, our application would still have half of its capacity online.

The new ASG will also:

  • Automatically replace an instance if the instance fails a health check.
  • Attempt to respond to availability zone outages by temporarily adding additional instances to the remaining healthy zone.
  • Automatically inform CodeDeploy about new instances so
...