1
votes

Looking for advice on the recommended way of setting up autoscaling for a pair of EC2 instances running a Nginx-based web service behind an ELB.

I understand that I'll need to use CloudWatch to monitor my EC2 instances - is it sufficient to save my EC2 instance as an AMI image and then have CloudWatch fire up new instances using that image (with ELB automatically routing requests in round-robin fashion to available instances)?

1

1 Answers

1
votes

You can attach your load balancer to your Auto Scaling Group (ASG). When attached, the load balancer automatically registers the newly launched instances in the group and distributes the traffic across them. For adding health checks to the ASG with a load balancer attached to it, you need to:

  1. Go to EC2 console
  2. Choose Auto Scaling Group under Auto Scaling
  3. Select your group and click Actions and then Edit
  4. Select ELB for Health Check Type and set the period (e.g. 300)
  5. Save

Note that an ASG with EC2 health check type will not automatically replace the unhealthy instances. Read more here.