Day 6 - CloudFront

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

AWS A cad emy Clou d Fou n d ation s

Day 6: CloudFront

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Introduction to AWS Elastic Beanstalk

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Elastic Beanstalk

• An easy way to get web applications up and running

• A managed service that automatically handles –


• Infrastructure provisioning and configuration
• Deployment
• Load balancing
• Automatic scaling
AWS Elastic • Health monitoring
Beanstalk • Analysis and debugging
• Logging

• No additional charge for Elastic Beanstalk


• Pay only for the underlying resources that are used
© 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved. 3
AWS Elastic Beanstalk deployments

• It supports web applications


written for common platforms
• Java, .NET, PHP, Node.js, Python,
You Your code
Ruby, Go, and Docker manage
HTTP server

• You upload your code Application server


AWS Language interpreter
• Elastic Beanstalk automatically manages
handles the deployment Operating system

• Deploys on servers such as Apache, Host


NGINX, Passenger, Puma, and
Microsoft Internet Information
Services (IIS)

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved. 4
Benefits of Elastic Beanstalk

Fast and simple to Developer Difficult to Complete resource


start using productivity outgrow control

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved. 5
To complete this activity:
Activity: AWS
Elastic Beanstalk • Go to the hands-on lab environment and
launch the AWS Elastic Beanstalk activity.

• Follow the instructions that are provided in


the hands-on lab environment.

6 © 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• AWS Elastic Beanstalk enhances developer
productivity.
key takeaways • Simplifies the process of deploying your
application.
• Reduces management complexity.

• Elastic Beanstalk supports Java, .NET, PHP,


Node.js, Python, Ruby, Go, and Docker

• There is no charge for Elastic Beanstalk.


Pay only for the AWS resources that you
use.

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

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Content delivery and network latency

Hop
Router
Hop Hop
Origin server
Hop
Router
Router
Hop
Hop

Client
Router Hop
User

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 9
Content delivery network (CDN)

• Is a globally distributed system of caching servers


• Caches copies of commonly requested files (static content)
• Delivers a local copy of the requested content from a nearby cache edge or
Point of Presence
• Accelerates delivery of dynamic content
• Improves application performance and scaling

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

• Fast, global, and secure CDN service


• Global network of edge locations and
Regional edge caches
Amazon
CloudFront
• Self-service model
• Pay-as-you-go pricing

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 11
Amazon CloudFront infrastructure

Edge locations

Multiple edge locations

Regional edge caches

• Edge locations – Network of data centers


that CloudFront uses to serve popular content
quickly to customers.

• Regional edge cache – CloudFront


location that caches content that is not
popular enough to stay at an edge location.
It is located between the origin server and
the global edge location.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 12
Amazon CloudFront benefits

• Fast and global


• Security at the edge
• Highly programmable
• Deeply integrated with AWS
• Cost-effective

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 13
Amazon CloudFront pricing

Data transfer out


• Charged for the volume of data transferred out from Amazon CloudFront edge location
to the internet or to your origin.
HTTP(S) requests
• Charged for number of HTTP(S) requests.
Invalidation requests
• No additional charge for the first 1,000 paths that are requested for invalidation each
month. Thereafter, $0.005 per path that is requested for invalidation.
Dedicated IP custom SSL
• $600 per month for each custom SSL certificate that is associated with one or more
CloudFront distributions that use the Dedicated IP version of custom SSL certificate
support.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 14
• A CDN is a globally distributed
key takeaways system of caching servers that
accelerates delivery of content.
• Amazon CloudFront is a fast CDN
service that securely delivers data,
videos, applications, and APIs over a
global infrastructure with low
latency and high transfer speeds.
• Amazon CloudFront offers many
benefits.

15 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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 single Availability
Elastic Load
Zone or across multiple Balancing
Availability Zones.
• Scales your load balancer as
IP addresses
traffic to your application
Containers
changes over time. EC2 instances Lambda functions

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 17
Types of load balancers

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 18
How Elastic Load Balancing works
• With Application Load
Balancers and Network Load
Balancers, you register
targets in target groups, and AWS Cloud
route traffic to the target Load balancer accepts
incoming traffic
groups. Availability Zone A
from clients.
Availability Zone B

• With Classic Load Balancers,


you register instances with
the load balancer. Listener checks for
Listener connection requests. Listener

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 reserved. 19
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 reserved. 20
Activity: Elastic Load Balancing

You must support traffic to a containerized Application Load Balancer


application.

You have extremely spiky and unpredictable TCP Network Load Balancer
traffic.

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

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


an IP target outside a VPC.

You need a load balancer that can handle millions of Network Load Balancer
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 reserved. 21
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 of API
interactions in AWS services.
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 22
• Elastic Load Balancing distributes
key takeaways incoming application or network
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.

23 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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 reserved. 25
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 reserved. 26
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 reserved. 27
Activity: Amazon CloudWatch
If average CPU utilization is > 60% for 5
Correct!
minutes…
Amazon EC2
If the number of simultaneous connections is >
Correct!
10 for 1 minute…
Amazon RDS
If the maximum bucket size in bytes is around Incorrect. Around is not a threshold option.
3 for 1 day… You must specify a threshold of >, >=, <=, or <.
Amazon S3
If the number of healthy hosts is < 5 for 10
Correct!
minutes…
Elastic Load Balancing
If the volume of read operations is > 1,000 for Incorrect. You must specify a statistic (for
10 seconds… example, average volume).
Amazon Elastic
Block Store
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 28
• Amazon CloudWatch helps you
Section 2 key monitor your AWS resources—and the
takeaways 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.
29 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
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 reserved. 31
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 the
Su M T W Th F Sa
instances without your intervention
• Provides several scaling options –
Used capacity Provisioned capacity
Manual, scheduled, dynamic or on-
(demand) demand, and predictive

© 2019 Amazon Web Services, Inc. or its Affiliates. All rights reserved. 32
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 reserved. 33
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 reserved. 34
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 management.
Minimum size Launch or terminate
instances as needed

Desired capacity

Maximum size
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 35
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 reserved. 36
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 configuration Auto Scaling group • Scheduled actions
• AMI • VPC and subnets
• Instance type • Load balancer Dynamic scaling
• IAM role • Scaling policies
• Security groups
• EBS volumes Predictive scaling
• AWS Auto Scaling
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 37
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 reserved. 38
AWS Auto Scaling

• Monitors your applications and automatically


adjusts capacity to maintain steady, predictable
performance at the lowest possible cost
AWS Auto Scaling • 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 reserved. 39
• Scaling enables you to respond quickly to
changes in resource needs.
key takeaways • Amazon EC2 Auto Scaling maintains
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.
40 © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lab:
Scale and Load
Balance Your
Architecture

41 © 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 reserved. 42
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 reserved. 43
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 reserved. 44
Complete the knowledge check

© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 45
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