How it works…

This example defines an autoscaling group and dependent resources. These include the following:

  • A launch configuration to use when launching new instances. Launch configurations are templates that describe the settings for newly launched instances.
  • Two scaling policies: one to scale the number of instances up, and an inverse policy to scale back down.
  • A CloudWatch alarm to alert when the CPU crosses a certain threshold for a certain number of minutes. CloudWatch is the AWS logging and monitoring solution and is covered in more detail in Chapter 5, Monitoring the Infrastructure.

The autoscaling group and launch configuration resource objects in this example use mostly default values. You will need to specify your own SecurityGroups and a KeyName parameter in the LaunchConfiguration resource configuration if you want to be able to connect to the instances (for example, via SSH).

AWS will automatically take care of spreading your instances evenly over the subnets you have configured, so make sure that they are in different AZs! When scaling down, the oldest instances will be removed before the newer ones.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset