You are on page 1of 45

● demand to services fluctuates

○ fluctuation occurs in different time scales


■ year-long cycle/pattern: Christmas shopping,
summer travelling
■ fluctuation within 90 min: demands on Google
during world cup final
● Fixed resource provisioning results in
under/over-provisioning
○ under-provisioning: slow system response, unable to
serve clients
○ over-provisioning: waste of resources
● scaling adjusts system capacity according to demand
○ usually based on some metrics (e.g. CPU utilisation,
network latency, etc.)
● Vertical scaling means that you scale by adding more
power (CPU, RAM) to an existing machine
● Scale up : more powerful server
● Scale down : less powerful server
● Horizontal scaling means that you scale by adding
more machines into your pool of resources
● Scale out : more instances
● Scale in : few instances
Create Self Sign Certificate (Optional)
Step 1: Creating the launch configuration
Step 2: Create Auto Scaling Group
Group name and size do not require further explications but
we have to spend a few words on the Network choice: If your
AWS account has been created before April 2013 we can
choose to create our Auto Scaling Group either on a VPC or
an EC2-Classic environment requiring one more choice: the
Availability Zones:

With an EC2-VPC-Only account we can choose an existing


VPC and the subnets where launch our AS Group or of
course, we can choose to create a new VPC or even add
other subnets to a pre-existing VPC.
In the Advanced Details pull down we can add an Elastic Load
balancer and select the type of checks to perform on the
instances (ELB ones on EC2 Status Checks). We can also
tune the period that the ELB waits before starting to check the
instances (Health Check Grace Period) according to our
needs. If we want to take advantage of CloudWatch detailed
monitoring we have to enable it here:
The second tab allows to choose between two fundamental
scaling plans:

Keep this group at its initial size: This policy ensures that our
group maintains a number of healthy instances equal to the
initial size: as an instance fail checks it will be replaced.
Use scaling policies to adjust the capacity of this group: This
policy let us choose on which CloudWatch metrics/alarms
increase or decrease our Group size:
We can set the minimum and the maximum number of
instances composing our AS group. CloudWatch alarms can
be easily added after but we’ll add now the one to permit our
group to increase its size as shown below:
Once added the alarm our Increase Group Size policy will
look like this:
We’ll add the scale down policy later, now it’s time to
configure the notifications relative to our group:
The last tab allow us to review and eventually edit our
configuration:
After pressing the Create Auto Scaling Group button we’re
taken to a status screen showing the creation of our
resources. If something fails you’re prompted to retry the
single resource creation.
Once the Auto Scaling group is successfully created we can
select it, go to the Scaling Policies tab and edit the Decrease
Group Size policy to fit our needs:
In our example we’re requesting a scale down when the group
average CPU utilization decreases below the 20% and to
avoid spikes, we consider 3 consecutive periods of 1 minute.
After creating the alarm and saving the changes our Decrease
Group Size policy will look as in the image below:
Our Auto Scaling Group is ready and fully working: It can
scale between 2 and 12 instances using average CPU load.
All traffic passes through an Elastic Load Balancer allowing us
to monitor the global application health too.

Our Demo is over, time to clean up:


● https://aws.amazon.com/autoscaling/

● https://docs.aws.amazon.com/autoscaling/ec2/userguide/AutoScalingGrou
p.html

● https://aws.amazon.com/elasticloadbalancing/

● https://docs.aws.amazon.com/AmazonECS/latest/developerguide/load-bala
ncer-types.html

● http://docs.aws.amazon.com/autoscaling/latest/userguide/GettingStartedTu
torial.html

● https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-create
-https-ssl-load-balancer.html

You might also like