Sunteți pe pagina 1din 61

Module 3:

Building in the cloud


Patrick Do
Technical Trainer
AWS

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Go beyond
servers and storage

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Migration and reinvention

Reinvention

Value Cloud-Native Retire


tech debt
Foundation
Project

Time

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Improving your initial project
AWS Cloud

Instance challenges:
• Performance
• Scalability S3 bucket
• Utilization
(static content)

Database challenges:
EC2 • Infrastructure management
• Patching
Internet • Scalability
gateway Web application EBS volume
(database files) Management challenges:
• Monitoring
• Planning for failures
Instance store • Deployment
(ephemeral)

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Monitor AWS resources

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon CloudWatch?

• Monitors:
• AWS resources
• Applications running on AWS
• Collects and tracks:
• Standard metrics
• Custom metrics
• Alarms:
• Send notifications
• Automatically make changes
based on rules you define

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How CloudWatch works

CloudWatch

CloudWatch
Supported CPUUtilization alarm SNS email
AWS resource notification
StatusCheckFailed
PageViewCount
CloudWatch metrics Available
statistics
Amazon EC2
Auto Scaling
Custom
application-specific
metrics AWS Management
Console
Statistics
consumer

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Manage demand efficiently

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why scaling matters

Su M T W Th F Sa

Demand Capacity

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why scaling matters

Unused
capacity

Su M T W Th F Sa

Demand Capacity

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why scaling matters

Over
capacity

Su M T W Th F Sa

Demand Capacity

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why scaling matters

Amazon EC2 Auto Scaling adjusts


capacity as needed
• Scale out for spikes
• Scale in during off-peak
• Replace unhealthy instances
Su M T W Th F Sa • Pay only for what you use

Demand Capacity

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dynamic scaling with Amazon EC2 Auto Scaling
Follow the demand curve for your applications

Amazon EC2 Auto Scaling group


• Select a load metric
for your application
Max 10
• Set as conditional Min 2 instance instance instance
and/or scheduled Desired 6
• Use with CloudWatch,
optionally instance instance instance

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dynamic scaling with Amazon EC2 Auto Scaling
Follow the demand curve for your applications

Amazon EC2 Auto Scaling group


• Select a load metric
for your application
Max 10
• Set as conditional Min 2 instance instance instance instance instance
and/or scheduled Desired 10
• Use with CloudWatch,
optionally instance instance instance instance instance

High demand

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Dynamic scaling with Amazon EC2 Auto Scaling
Follow the demand curve for your applications

Amazon EC2 Auto Scaling group


• Select a load metric
for your application
Max 10
• Set as conditional Min 2 instance
and/or scheduled Desired 2
• Use with CloudWatch,
optionally instance

Low demand

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fleet management with Amazon EC2 Auto Scaling
Replace impaired Amazon EC2 instances without intervention

Amazon EC2 Auto Scaling group


• Monitor the health
of running instances
Max 10 AZ1
• Replace impaired Min 2
instances automatically Desired 10
Instance Instance Instance Instance Instance

• Balance capacity across


Availability Zones AZ2
Instance Instance Instance Instance Instance

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fleet management with Amazon EC2 Auto Scaling
Replace impaired Amazon EC2 instances without intervention

Amazon EC2 Auto Scaling group


• Monitor the health
of running instances
• Replace impaired
instances automatically
Max
Min
Desired
10
2
10
AZ1
Instance Instance Instance Instance
O
Instance

• Balance capacity across


Availability Zones AZ2
Instance Instance Instance Instance
O
Instance

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Fleet management with Amazon EC2 Auto Scaling
Replace impaired Amazon EC2 instances without intervention

Amazon EC2 Auto Scaling group


• Monitor the health
of running instances
Max 10 AZ1
P
• Replace impaired Min 2
instances automatically Instance Instance Instance Instance

P
Instance
Desired 10
• Balance capacity across
Availability Zones AZ2
Instance Instance Instance Instance Instance

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Elastic Load Balancing
Automatically distribute traffic across multiple targets

High availability

Health checks Elastic Load


Balancing
SSL/TLS termination

Operational monitoring
Instance Instance Instance Instance Instance

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Load Balancer example
EC2 instance

/images

Application 1

/api

Application 2

Application Load Balancer /data

Application 3

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Network Load Balancer example
EC2
AutoScaling
5442 EC2

5442 EC2

Streaming Data
Network Load Balancer 5442 EC2

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deploy database services

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DIY vs. AWS database services

• Operating system access • Easy to set up, manage, maintain

• Need features of specific • Push-button high availability


application • Focus on performance
• Managed infrastructure

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Relational Database Service?
A database service that makes it easy to set up,
operate, and scale a relational database in the cloud

Amazon RDS Engines • Easily scalable

• Automatic software patching

• Automated backups

• Database snapshots

• Multi-AZ deployments

• Automatic host replacement


• Encryption at rest and in transit

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Aurora?

• Enterprise-class relational database

• MySQL- or PostgreSQL-compatible

• Up to 5X faster than standard MySQL databases

• Up to 3X faster than standard PostgreSQL databases

• Continuous backup to Amazon S3

• Up to 15 low-latency read replicas

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Relational vs key-value databases
Relational (SQL) Key-value (NoSQL)
Data storage Rows and columns Key-value, document, graph
Schemas Fixed Dynamic

Querying Using SQL Focused on collection of documents

Scalability Vertical Horizontal

ISBN Title Author Format {


ISBN: 3111111223439,
Withering Tark, Title: “Withering Depths”,
Example 3111111223439 Paperback
Depths Frank Author: ”Tark, Frank”,
Felton, Format: “Paperback”
3122222223439 Wily Willy eBook }
Maria

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon DynamoDB?

Fast and flexible NoSQL database service for any scale

• Fully managed

• Low-latency queries

• Fine-grained access control

• Regional and global options

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DynamoDB use cases

• Serverless web applications

• Microservices data store

• Mobile backends

• Ad tech

• Gaming

• Internet of Things (IoT)

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Other purpose-built database services

Amazon Redshift Amazon DocumentDB Amazon Neptune


Fast, scalable MongoDB-compatible Graph database
data warehouse database

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is AWS Database Migration Service?
Migrate databases to AWS quickly and securely

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The right tool for the right job
What are my requirements?

Amazon Relational
Enterprise class relational database Database Service
(Amazon RDS)

Fast and flexible NoSQL database service


Amazon DynamoDB
for any scale

Operating system access or application


features not supported by AWS database Databases on EC2
services

Specific case-driven requirements AWS purpose-built


(Machine learning, data warehouse, graphs) database services

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Automate deployment

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is AWS CloudFormation?

Model and provision all your cloud infrastructure resources

Code your infrastructure Check out your template Create a stack based AWS CloudFormation
template in either YAML code locally or upload on your template code provisions the resources
or JSON format to an S3 bucket.

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS CloudFormation example
VPC (10.1.0.0/16)

Public Subnet 1
(10.1.11.0/24)

Template-file
(YAML/JSON) Web
----- -- -- --- -- ----- Internet server
-- -- --- --
----- -- -- --- -- gateway
----- -- -- --- -- Security group

CloudFormation Designer

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Putting it all together (1 of 4)
AWS Cloud

S3 bucket
(static content)

EC2

Internet
Internet
gateway Web application
EBS volume
(database files)

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Putting it all together (2 of 4)
AWS Cloud

S3 bucket
(static content)

EC2

Internet
Internet
gateway Web application
Amazon RDS

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Putting it all together (3 of 4)
AWS Cloud

S3 bucket
Auto Scaling group (static content)

Internet Elastic Load


Internet
gateway Balancing EC2 Instances Amazon RDS

CloudWatch

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Putting it all together (4 of 4)
AWS Cloud

S3 bucket
Auto Scaling group (static content)

Internet Elastic Load


Internet
gateway Balancing EC2 Instances Amazon RDS

AWS
CloudWatch
CloudFormation

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How can I deploy without managing infrastructure?

Quickly deploy and manage applications with AWS Elastic Beanstalk

• Upload your application code


• The service handles:
 Resource provisioning
 Load balancing
 Automatic scaling
 Monitoring
• Support applications that scale
to serve millions of users

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Connect and share data

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Challenge: hybrid cloud
Network challenges: AWS Cloud Communications challenge:
• Performance
• Cloud instances cannot
• Reliability Amazon EC2
Clients route to onsite servers
Auto Scaling group

Internet
gateway

EC2 instances EBS volumes

Storage challenges:
• Duplication of data onsite/offsite
• Too much network traffic
Corporate data center
• Cost inefficient

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is AWS Direct Connect?
A dedicated network connection from your premises to AWS

Reduces network costs

Creates consistent network performance

Provides private connectivity to your Amazon VPC

Scales easily

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Direct Connect example
AWS Direct AWS Cloud
Connect location
VPC

Content Virtual private


router/firewall Customer AWS Direct gateway
or partner Connect
router endpoint EC2 instances

Corporate data center

Other AWS Services

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Route 53?
A highly available and scalable Domain Name System (DNS) web service

Register domain names

Route internet traffic to the resources for your domain

Check the health of your resources

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Routing traffic
https://sales.example.com

Amazon Route 53

VPC

ELB ELB ELB

EC2 instances

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Elastic File System (Amazon EFS)?
A scalable, elastic, cloud-native file system for Linux

Dynamic elasticity

Scalable performance

Shared file storage

Fully managed

Cost-effective

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Putting it all together
AWS Cloud

Clients Amazon EC2 Auto


Scaling group

Internet
gateway Amazon Virtual AWS Direct Connect
EFS private
gateway
EC2 instances

Amazon Route 53
Corporate data center

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Deliver content faster

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Challenge: media streaming service

The architecture must meet the following requirements:

Transcode
Ingest Catalog Stream
video to
encoded video video to
multiple
video metadata clients
formats

Efficient, scalable Fast data Low latency


compute resources access

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda: run code without servers

AWS HTTP
SERVICES ENDPOINTS

MOBILE APPS

Upload your code Set your code to trigger Lambda runs your code Pay only for the
to AWS Lambda from an event source only when triggered compute time you use

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Benefits of Lambda

Supports multiple programming languages

Completely automated administration

Built-in fault tolerance

Supports orchestration of multiple functions

Pay per use pricing

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda example: create thumbnails
AWS Cloud
1
3

2
User

Lambda 4
Source
bucket

Execution
5
role
Access
policy
JSON

Target bucket
Lambda function

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Simple Notification Service (Amazon SNS)?

Fully managed pub/sub messaging for distributed or serverless applications

Reliably deliver messages with durability

Automatically scale your workload

Simplify your architecture

Keep messages private and secure

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SNS overview

Amazon Simple Notification Service AWS Lambda

Message Queues

HTTP/S
SNS topics Message filters
Publisher Subscribers

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon CloudFront?

A fast, secure, and global content delivery network (CDN)

© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How CloudFront delivers content to users

www.example.com/content

cache

S3 bucket
Edge location

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon ElastiCache?

Fully managed Redis or Memcached-compatible in-memory data store

Amazon ElastiCache
Extreme performance for Redis
Versatile in-memory data store

Fully Managed
Amazon ElastiCache
for Memcached
Scalable Scalable caching tier
for data-intensive apps

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Challenge: Media streaming service
AWS Cloud Video metadata

Lambda ElastiCache Search


DynamoDB
HQ for Redis

480p

Video CloudFront Ingest SNS topic Playback CloudFront Stream


360p S3 bucket
encoders S3 bucket Streaming

Audio only

AWS Lambda transcoding functions


Clients

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Key Takeaways
Amazon CloudWatch Have complete visibility of your cloud resources and applications

Elastic Load Balancing


Deploy highly available applications that scale with demand
Application Auto Scaling

AWS Database Services Run SQL or NoSQL databases without the management overhead

AWS CloudFormation Programmatically deploy repeatable infrastructure

AWS Elastic Beanstalk Deploy your application in the simplest way possible

AWS Direct Connect Provision a dedicated network connection from your premises to AWS

Amazon Route 53 Run a highly available and scalable Domain Name System (DNS) web service

AWS Lambda Run code without managing servers

Amazon CloudFront Deliver your content across a massively scaled and globally available network

© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.

S-ar putea să vă placă și