Lab 9. Enabling Auto Scale to Handle Spikes and Troughs

Overview

In this lab we are going to create an auto scaling 2 Web servers and check how it works when the main 2 servers were terminated and what happens when we change the auto scaling configurations.

Auto Scaling

Auto Scaling helps you maintain application availability and allows you to scale your Amazon EC2 capacity up or down automatically according to conditions you define. You can use Auto Scaling to help ensure that you are running your desired number of Amazon EC2 instances. Auto Scaling can also automatically increase the number of Amazon EC2 instances during demand spikes to maintain performance and decrease capacity during lulls to reduce costs. Auto Scaling is well suited both to applications that have stable demand patterns or that experience hourly, daily, or weekly variability in usage.

In this lab you will learn:

  • How to create an auto scaling Group
  • How to configure the Auto scaling group
  • How it works

The image shown below is the architecture for this lab.

Capture

To begin with the lab you have to go to > Services and select EC2.

Screenshot (33)

In the left pane you will find Auto Scaling. Click on the Create Auto Scaling Group

Screenshot (34)

Click on Launch Configurations

Screenshot (35)

On the left pane of Create Launch Configuration you will see My AMIs Click on it and select DinostoreWebServer.

Screenshot (36)

Choose general Purpose t2.micro click on Next.

Screenshot (37)

In the configuration Details you have to give your IAM role as WebserverRole1 (You can give the name you created)

Screenshot (39)

keep the default settings in Add storage and click on next.

Screenshot (40)

In the configure security group select an existing security group ‘Select WebRDPGroup’ you created and click on Review.

Screenshot (41)

Click on Create Launch Configuration and make sure you choose an existing Key pair you created with your web server.

Screenshot (42)

In the Auto Scaling Group give the group name as scale-web-asg.

Screenshot (43)

In group size make the 1 instance in to 2. select 2 subnets it will automatically give you the options just click on it and select. In Advance details Tick on receive traffic from from one or more load balancers. In Classic Load Balancers select the load balancer you created DinoStoreLB, In the health check type select ELB and click on Next.

Screenshot (44)

Keep the default settings and click on Next.

Screenshot (45)

Add an Tag because it will be easier for You to recognize. Therefore i have given the name as  = ASG-WebServer, tick ‘Tag instances

Screenshot (46)

Click on Create Auto Scaling Group.

Screenshot (47)

Go to your instances and check whether there getting deployed and wait till status gets till 2/2.

Screenshot (48)

From the Left pane select load balancer and check if the instances status shows in-service if its in service copy the LB URL and paste it in your local Broswer

Screenshot (49)

Check how many IPs will show up on the left top corner of the site. for me these 2 are the IPs

172.31.40.195
172.31.28.213 (For you IPs will be different.)

Screenshot (50)Screenshot (51)

Now terminate you original 2 instances Check if it giving the IPs.

Screenshot (52)

Terminate One of your auto scaling webserver you createdand check for a different IP if you are getting or not.

Note: if you want to stop the auto scaling instances go to Auto Scaling Groups and click on the auto scaling group you created and click on actions and make 2 instances minimum and maximum to 0. when you terminate you Auto scaling instance the 2nd auto scaling instance will be terminated automatically

Screenshot (53)Screenshot (54)Screenshot (55)

When all these above steps are done successfully, you have completed Lab 9.

Conclusion

By the end of this lab you learned:

  • How to create an auto scaling Group
  • How to configure the Auto scaling group
  • How it works

Budget

Auto Scaling is enabled by Amazon CloudWatch and carries no additional fees. Amazon EC2 and Amazon CloudWatch service fees apply and are billed separately. Partial hours are billed as full hours. When you are done with this lab go Autoscaling Configuration and change the values to 0, If not it will keep on creating instances.

Advertisements
This entry was posted in Dinostore Labs. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s