[Recipes] Auto scaling Groups and Launch Configurations

Problem: 

Demo Auto scaling Groups and Launch Configurations.

Solution Summary: 

First create launch configuration and them create auto scaling groups. 

Solution Steps: 

  1. Create a file for health checking: index.html with some dummy contents (e.g. healthy).

  2. Login to AWS console and log into S3 console.

  3. Create a bucket: Give any name (e.g. buddywebsitebucket), select a region same as the region you will be launching EC2 instance.

  4. Upload healthcheck.html file into the bucket.

  5. Got to EC2

  6. Create an Elastic Load Balancer with same configurations as we have created before (refer to previous notes).

  7. Click on Launch Configurations under the Auto Scaling section.

  8. Before creating an autoscaling group, you need to create launch configurations:

    1. Select Amazon AMI, t2 micro, give a name (e.g. BuddyAutoScalingGroup), select the s3 admin access role we had created (create one if needed), use the same bootstrap script as before, use existing web dmz security group (or create one if needed), use existing EC2 key-pair(or create one if needed).

    2. After creating launch configuration, you need to create auto scaling group.

  9. In the Create Auto Scaling group page,

    1. Give a name (e.g. BuddyAutoScalingGroup), give a group size of 3, use default vps,

    2. Click inside Subnet value field to select all availability zones one by one.

      1. The 3 instances within the group will be distributed 1 each to the three availability zones in this case.

    3. Under Advanced Details

      1. Select option to Receive traffic from Elastic Load Balancers and select the Load Balancer we had created.

      2. Select Health Check type as ELB.

      3. Set Health Check Grace period as 150 seconds.

      4. Click Next

  10. In the Configure Auto scaling policies page,

    1. Select the option as: keep this group at its initial size.

    2. Click Next.

  11. In Configure Notifications page,

    1. Leave options as is for now. Click Next.

  12. Add tags: Department: BuddyDemoDept.

  13. Review and Create.

  14. Go back to EC2 dashboard and go to Instances. You should see 3 new instances getting launched in 3 different availability zones.

  15. Try running each public ip in the browser to make sure everything has gone well.

  16. Try running the ELB dns and it will go to one of the servers.

  17. To simulate failure, delete two instances.

  18. Try running all urls.

  19.  Wait for some time and refresh instances page to see that Autoscaling will create new instances with new public ip.

  20. Delete your Autoscaling group.

    1. It will automatically terminate all instances it created.

 

Note: Do additional cleanup if you are not going to continue with labs now.

 

Exam Tips

  1. The solution can be further improved with Route 53, wherein even a region failure can result in diverting traffic to other regions.

 

TODO

  1. Use scaling policies to adjust the capacity of this group (in the Configure Auto scaling policies page).

  2. Configure Notifications (in Configure Notifications page)

Learn Serverless from Serverless Programming Cookbook

Contact

Please first use the contact form or facebook page messaging to connect.

Offline Contact
We currently connect locally for discussions and sessions at Bangalore, India. Please follow us on our facebook page for details.
WhatsApp (Primary): (+91) 7411174113
Phone (Escalations): (+91) 7411174114

Business newsletter

Complete the form below, and we'll send you an e-mail every now and again with all the latest news.

About

Cloudericks.com is my blog to share notes and learning materials on Cloud and Data Analytics. My current focus is on Amazon Web Services.

I like to write. I try to document what I learn and share with others. I believe that knowledge is useless unless you share it; the more you share, the more you learn.

Recent comments

Photo Stream