Auto Scaling

AWS Services

  • Amazon Auto Scaling
  • Amazon Elastic Compute Cloud (EC2)
  • Amazon Elastic Load Balancing

Summary

You are required to future-proof your infrastructure and must use an auto-scaling group that handles 1 to 4 EC2 instances, currently manually set at 2. Each EC2 instance should host a static web server that outputs its own instance ID. You should then expose the instances behind a load balancer and verify that scaling works correctly, including that each instance correctly displays its own instance ID.

Task

  1. Create an auto-scaling group configured to manage 1 to 4 instances, with the desired capacity set to 2.
  2. Use a launch template that provisions EC2 instances:
    • Instances should run Amazon Linux 2.
    • Ensure each instance hosts a static web server displaying its instance ID on the default page.
  3. Deploy an Application Load Balancer:
    • Attach the load balancer to public subnets.
    • Configure the load balancer to route HTTP traffic to the instances.

Verification:

  • Access the load balancer’s DNS name and confirm it routes traffic to the EC2 instances.
  • Check that each instance correctly displays its unique instance ID when accessed through the load balancer.

Hints:

  • In the launch template, use a startup script to configure a web server and set up the default page with the instance ID. Research how to use metadata to retrieve the instance ID during boot.
  • Use the AWS Management Console or CLI to check that the load balancer is healthy and properly routing traffic to the instances.
Last updated on