ASG Auto Scaling Groups

You are here:
< All Topics

Auto Scaling Groups or ASGs provide a way to scale in and out with your instances and infra.

 

Scale out: add instances for increased workload

 

Scale in: remove instances for decreased workload

 

you can set a minimum, desired, and maximum capacity no of instances

 

automatically connect new instances to a load balancer

 

recreate an instance if a previous one is terminated eg if unhealthy

 

ASG is FREE! – but you pay for the underlying instances

 

ASGs also work with load balancers

 

You create a Launch Template (used to be called Launch Configuration – now deprecated)

 

in this you set:

 

AMI and instance type

 

EC2 user data script, if used
EBS volumes
security groups
ssh key pair
IAM roles for the instances
network/subnet info
lb info

 

plus also set
min,max,initial capacity
scaling policies

 

CloudWatch Alarms also integrate with ASGs.

 

you set a metric to be monitored by CW and this then triggers the ASG activity eg scale in policy or scale out policy.

 

 

 

ASG Termination Policy

by default, ASG looks for the AZ which has the most number of instances, and then deletes the one within that AZ which has the oldest launch configuration.

ASG always seeks to balance number of instances across AZs by default.

 

 

Lifecycle Hooks

 

when an instance is launched you can first determine that it goes first into a pending state, you then move it into pending proceed.. then it goes into in service state.

 

if no pending state, then it goes straight to in-service state.

 

 

also for teminating, you can set a terminating wait state, this is so you have time to carry out some other actions first.

 

 

Launch Configs – these are legacy deprecated, you have to recreate each time.
Launch Templates – new, are versionable, recommended by AWS

 

only use Launch Templates from now on!

 

 

 

 

 

 

Table of Contents