You are on page 1of 39

AW S A c a d e m y C l o u d F o u n d a t i o n s

Module 10: Automatic Scaling and


Monitoring

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module overview

Topics Activities
• Elastic Load Balancing • Elastic Load Balancing activity
• Amazon CloudWatch activity
• Amazon CloudWatch
• Amazon EC2 Auto Scaling
Lab
• Scale and Load Balance Your
Architecture

Knowledge check
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
2
reserved.
Module objectives

After completing this module, you should be able to:


• Indicate how to distribute traffic across Amazon Elastic Compute
Cloud (Amazon EC2) instances by using Elastic Load Balancing
• Identify how Amazon CloudWatch enables you to monitor AWS
resources and applications in real time
• Explain how Amazon EC2 Auto Scaling launches and releases
servers in response to workload changes
• Perform scaling and load balancing tasks to improve an architecture

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


3
reserved.
Module 10: Automatic Scaling and Monitoring

Section 1: Elastic Load Balancing

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Elastic Load Balancing

• Distributes incoming
application or network traffic
across multiple targets in a
Elastic Load
single Availability Zone or Balancing
across multiple Availability
Zones.
IP addresses
• Scales your load balancer as
Containers
traffic to your application EC2 instances Lambda functions

changes over time.

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


5
reserved.
Types of load balancers

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


6
reserved.
How Elastic Load Balancing works
• With Application Load
Balancers and Network
Load Balancers, you
register targets in target AWS Cloud
groups, and route traffic to Load balancer accepts
incoming traffic
the target groups. Availability Zone A
from clients.
Availability Zone B

• With Classic Load


Balancers, you register
instances with the load Listener checks for
Listener connection requests. Listener
balancer.
Load balancer routes
Load balancer traffic only to
performs health  . healthy targets.  .  .  .
checks to monitor
health of registered
targets.
Target
X
Target Target Target Target

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


7
reserved.
Elastic Load Balancing use cases

Highly available and Containerized Elasticity


fault-tolerant applications and scalability
applications

Virtual private Hybrid environments Invoke Lambda


cloud (VPC) functions over HTTP(S)
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
8
reserved.
Activity: Elastic Load Balancing

You must support traffic to a containerized Application Load Balancer


application.

You have extremely spiky and unpredictable Network Load Balancer


TCP traffic.

You need simple load balancing with multiple Classic Load Balancer
protocols.

You need to support a static or Elastic IP Network Load Balancer


address, or an IP target outside a VPC.

You need a load balancer that can handle Network Load Balancer
millions of requests per second while
maintaining low latencies.

You must support HTTPS requests. Application Load Balancer

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


9
reserved.
Load balancer monitoring

• Amazon CloudWatch metrics –


Used to verify that the system is
performing as expected and
creates an alarm to initiate an
action if a metric goes outside an
acceptable range.
• Access logs – Capture detailed
information about requests sent to
your load balancer.
• AWS CloudTrail logs – Capture
the who, what, when, and where
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
of API interactions in AWS
reserved.
services. 10
• Elastic Load Balancing distributes
Section 1 key incoming application or network
takeaways traffic across multiple targets in
one or more Availability Zones.
• Elastic Load Balancing supports
three types of load balancers:
• Application Load Balancer
• Network Load Balancer
• Classic Load Balancer
• ELB offers instance health
checks, security, and monitoring.

11 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 10: Automatic Scaling and Monitoring

Section 2: Amazon CloudWatch

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Monitoring AWS resources

To use AWS efficiently, you need insight into your AWS resources:

• How do you know when you should launch more Amazon EC2
instances?

• Is your application's performance or availability being affected by


a lack of sufficient capacity?

• How much of your infrastructure is actually being used?

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


13
reserved.
Amazon CloudWatch

• Monitors –
• AWS resources
• Applications that run on AWS
• Collects and tracks –
Amazon • Standard metrics
CloudWatch • Custom metrics
• Alarms –
• Send notifications to an Amazon
SNS topic
• Perform Amazon EC2 Auto Scaling
or Amazon EC2 actions
• Events –
• Define rules to match changes in
AWS environment and route these
events to one or more target
functions or streams for processing
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights
14
reserved.
CloudWatch alarms

• Create alarms based on –


• Static threshold
• Anomaly detection
• Metric math expression
• Specify –
• Namespace
• Metric
• Statistic
• Period
• Conditions
• Additional configuration
• Actions
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
15
reserved.
Activity: Amazon CloudWatch
If average CPU utilization is > 60% for 5
Correct!
minutes…
Amazon EC2
If the number of simultaneous connections
Correct!
is > 10 for 1 minute…
Amazon RDS
If the maximum bucket size in bytes is Incorrect. Around is not a threshold option.
around 3 for 1 day… You must specify a threshold of >, >=, <=,
Amazon S3 or <.
If the number of healthy hosts is < 5 for 10
Correct!
minutes…
Elastic Load Balancing
If the volume of read operations is > 1,000 Incorrect. You must specify a statistic (for
for 10 seconds… example, average volume).
Amazon Elastic
Block Store
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
16
reserved.
• Amazon CloudWatch helps you
Section 2 key monitor your AWS resources—and
takeaways the applications that you run on
AWS—in real time.
• CloudWatch enables you to –
• Collect and track standard and
custom metrics.
• Set alarms to automatically send
notifications to SNS topics, or perform
Amazon EC2 Auto Scaling or Amazon
EC2 actions.
• Define rules that match changes in
your AWS environment and route
these events to targets for processing.
17 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Module 10: Automatic Scaling and Monitoring

Section 3: Amazon EC2 Auto Scaling

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Why is scaling important?

Unused Over
capacity capacity

Su M T W Th F Sa Su M T W Th F Sa

Used capacity Provisioned capacity


(demand)

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights


19
reserved.
Amazon EC2 Auto Scaling

• Helps you maintain application


availability
• Enables you to automatically add or
remove EC2 instances according to
conditions that you define
• Detects impaired EC2 instances and
unhealthy applications, and replaces
Su M T W Th F Sa
the instances without your
intervention
Used capacity Provisioned capacity
• Provides several scaling options –
(demand) Manual, scheduled, dynamic or on-
demand, and predictive

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights


20
reserved.
Typical weekly traffic at Amazon.com

Provisioned capacity

Sunday Monday Tuesday Wednesday Thursday Friday Saturday

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


21
reserved.
November traffic to Amazon.com
Provisioned capacity 76 percent

The challenge is to efficiently


guess the unknown quantity of how
much compute capacity you need.

November
24 percent
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
22
reserved.
Auto Scaling groups

Auto Scaling group An Auto Scaling group is a


collection of EC2 instances that
are treated as a logical
grouping for the purposes of
automatic scaling and
Minimum size Launch or terminate
instances as needed management.
Desired capacity

Maximum size
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
23
reserved.
Scaling out versus scaling in

Elastic Load
Balancing

Auto Scaling group Auto Scaling group Auto Scaling group

Base configuration Scale out Scale in


(launch instances) (terminate instances)
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
24
reserved.
How Amazon EC2 Auto Scaling works
What Where When
VPC Maintain current number
Private subnet • Health checks
AMI

Auto Scaling group Manual scaling


EC2 instance • Min, max, desired capacity

Scheduled scaling
Launch
Auto Scaling group • Scheduled actions
configuration
• AMI • VPC and subnets
• Instance type • Load balancer Dynamic scaling
• IAM role • Scaling policies
• Security groups
• EBS volumes Predictive scaling
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights • AWS Auto Scaling 25
reserved.
Implementing dynamic scaling

Elastic Load Balancing

Auto Scaling group

CPU
utilization If average CPU
utilization is
> 60% for 5
minutes…

Run Amazon EC2 Auto Scaling policy


Amazon EC2 Auto Scaling Amazon CloudWatch
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
26
reserved.
AWS Auto Scaling

• Monitors your applications and automatically


adjusts capacity to maintain steady,
predictable performance at the lowest possible
AWS Auto Scaling cost
• Provides a simple, powerful user interface that
enables you to build scaling plans for
resources, including –
• Amazon EC2 instances and Spot Fleets
• Amazon Elastic Container Service (Amazon ECS)
Tasks
• Amazon DynamoDB tables and indexes
• Amazon Aurora Replicas
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
27
reserved.
• Scaling enables you to respond quickly
to changes in resource needs.
Section 3 key
• Amazon EC2 Auto Scaling maintains
takeaways application availability by automatically
adding or removing EC2 instances.
• An Auto Scaling group is a collection of
EC2 instances.
• A launch configuration is an instance
configuration template.
• Dynamic scaling uses Amazon EC2
Auto Scaling, CloudWatch, and Elastic
Load Balancing.
• AWS Auto Scaling is a separate service
from Amazon EC2 Auto Scaling.
28 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 6:
Scale and Load
Balance Your
Architecture

29 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab 6: Scenario
AWS Cloud

Region
Availability Zone A Availability Zone B
VPC: 10.0.0.0/16 Internet Public subnet 2:
Public subnet 1: gateway 10.0.2.0/24
10.0.0.0/24
Security group

NAT gateway
Web Server 1

Private subnet 1: Private subnet 2:


10.0.1.0/24 10.0.3.0/24
Security group Security group

RDS DB Primary RDS DB Secondary

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


30
reserved.
Lab 6: Tasks

• Create an Amazon Machine Image (AMI) from a running instance.


• Create an Application Load Balancer.
• Create a launch configuration and an Auto Scaling group.
• Automatically scale new instances within a private subnet.
• Create Amazon CloudWatch alarms and monitor performance of your
infrastructure.

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


31
reserved.
Lab 6: Final product
AWS Cloud
Region Availability Zone A Availability Zone B
VPC: 10.0.0.0/16 Internet
Public subnet 1: gateway Public subnet 2:
10.0.0.0/24 10.0.2.0/24
Security group

NAT gateway
Application
Private subnet 1: Load Balancer Private subnet 2:
10.0.1.0/24 10.0.3.0/24

Security group Security group


Web Auto Scaling Web
Instance group Instance

Security group Security group


RDS DB RDS DB
Primary Secondary
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights
32
reserved.
Begin lab 6
~ 30 minutes

Begin Lab 6: Scale


and Load Balance
Your Architecture

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


33
reserved.
Lab debrief:
Key takeaways

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


34
reserved.
Module 10: Automatic Scaling and Monitoring

Module wrap-up

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


reserved.
Module summary

In summary, in this module you learned how to:


• Indicate how to distribute traffic across Amazon Elastic Compute
Cloud (Amazon EC2) instances using Elastic Load Balancing.
• Identify how Amazon CloudWatch enables you to monitor AWS
resources and applications in real time.
• Explain how Amazon EC2 Auto Scaling launches and releases
servers in response to workload changes.
• Perform scaling and load balancing tasks to improve an architecture.

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


36
reserved.
Complete the knowledge check

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights


37
reserved.
Sample exam question

Which service would you use to send alerts based on Amazon CloudWatch
alarms?

A. Amazon Simple Notification Service


B. AWS CloudTrail
C. AWS Trusted Advisor
D. Amazon Route 53

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 38
Thank you

© 2019 Amazon Web Services, Inc. or its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in part, without prior written permission
from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited. Corrections or feedback on the course, please email us at: aws-course-
feedback@amazon.com. For all other questions, contact us at: https://aws.amazon.com/contact-us/aws-training/. All trademarks are the property of their owners.

You might also like