create cloud service on aws

58
雲端服務開發架構 概述 John Chang, Ecosystem Solutions Architect September 2016

Upload: amazon-web-services

Post on 23-Jan-2018

1.304 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Create cloud service on AWS

雲端服務開發架構概述

John Chang,

Ecosystem Solutions Architect

September 2016

Page 2: Create cloud service on AWS

Fintech Innovation

Page 3: Create cloud service on AWS

Agenda

• Why architecture matters?

• Pattern/Anti-pattern

• Cloud reference architectures

Page 4: Create cloud service on AWS

A scalable architecture

• Can support growth in users, traffic, data size

• Without practical limits

• Without a drop in performance

• Seamlessly - just by adding more resources

• Efficiently - in terms of cost per user

Page 5: Create cloud service on AWS
Page 6: Create cloud service on AWS
Page 7: Create cloud service on AWS
Page 8: Create cloud service on AWS
Page 9: Create cloud service on AWS

Day 1 – Dev & private beta

Page 10: Create cloud service on AWS

Single host

THE server

(e.g. Apache,

MySQL)

Elastic IP

www.example.com

Amazon Route 53

DNS service

Server Image (AMI)

Page 11: Create cloud service on AWS

Day 2 - Public beta

Page 12: Create cloud service on AWS

We need a bigger server

• Add larger & faster storage (EBS)

• Use the right instance type

• Easy to change instance sizes

• Not our long term strategy

• Will hit an endpoint eventually

• No fault tolerance

Page 13: Create cloud service on AWS

Separating web and DB

• More capacity

• Scale each tier individually

• Tailor instance for each tier– Instance type

– Storage

• Security– Security groups

– DB in a private VPC subnet

Page 14: Create cloud service on AWS

But how do I choose what

DB technology I need?

SQL? NoSQL?

Page 15: Create cloud service on AWS

Why start with a Relational DB?

• SQL is versatile & feature-rich

• Lots of existing code, tools, knowledge

• Clear patterns to scalability*

• Reality: eventually you will have a polyglot data layer

– There will be workloads where NoSQL is a better fit

– Use the right tool for each workload

* for read-heavy apps

Page 16: Create cloud service on AWS

Key Insight: Relational Databases are Complex

• Our experience running Amazon.com taught us that

relational databases can be a pain to manage and

operate with high availability

• Poorly managed relational databases are a leading

cause of lost sleep and downtime in the IT world!

• Especially for startups with small teams

Page 17: Create cloud service on AWS

Relational Databases

MySQL, Aurora, PostgreSQL, Oracle, SQL Server

Fully managed; zero adminAmazon

RDS

Aurora

Page 18: Create cloud service on AWS

Improving efficiency

Page 19: Create cloud service on AWS

Offload static content

• Amazon S3: highly available hosting that scales– Static files (JavaScript, CSS, images)

– User uploads

• S3 URLs – serve directly from S3

• Let the web server focus on dynamic content

Page 20: Create cloud service on AWS

Amazon CloudFront

• Worldwide network of edge locations

• Cache on the edge – Reduce latency

– Reduce load on origin servers

– Static and dynamic content

– Even few seconds caching of popular content can have huge impact

• Connection optimizations– Optimize transfer route

– Reuse connections

– Benefits even non cachable content

CloudFront

Page 21: Create cloud service on AWS

CloudFront for static & dynamic content

Amazon

Route 53

EC2 instance(s)

S3 bucket

Static content

Dynamic content

css/*

js/*

Images/*

Default(*)

CloudFront

distribution

Page 22: Create cloud service on AWS

Database caching

• Faster response from RAM

• Reduce load on database

Application server

1. If data in cache,

return result

2. If not in cache,

read from DBRDS database

Amazon ElastiCache

3. And store

in cache

Page 23: Create cloud service on AWS

Amazon ElastiCache: in-memory cache

• Simple to Deploy

• Managed– Automatically replaces failed nodes

– Patch management

• Elastic

• Compatible ElastiCache

Page 24: Create cloud service on AWS

Day 3 – Paying customers

Page 25: Create cloud service on AWS

High Availability

Availability Zone a

RDS DB

instance

Web

serverS3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Amazon CloudFront

ElastiCache

node 1

Page 26: Create cloud service on AWS

High Availability

Availability Zone a

RDS DB

instance

Availability Zone b

Web

serverWeb

serverS3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Amazon CloudFront

ElastiCache

node 1

Page 27: Create cloud service on AWS

High Availability

Availability Zone a

RDS DB

instance

Availability Zone b

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

serverS3 bucket for

static assets

Amazon CloudFront

ElastiCache

node 1

Page 28: Create cloud service on AWS

Elastic Load Balancing

• Managed Load Balancing Service

• Fault tolerant

• Health Checks

• Distributes traffic across AZs

• Elastic – automatically scales its capacity

Page 29: Create cloud service on AWS

High Availability

Availability Zone a

RDS DB

instance

Availability Zone b

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

serverS3 bucket for

static assets

ElastiCache

node 1

Amazon CloudFront

Page 30: Create cloud service on AWS

High Availability

Availability Zone a

RDS DB

instance

Availability Zone b

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

server

RDS DB

standby

S3 bucket for

static assets

ElastiCache

node 1

Amazon CloudFront

Page 31: Create cloud service on AWS

Data layer HA

Availability Zone a

RDS DB

instance

ElastiCache

node 1

Availability Zone b

S3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

server

RDS DB

standby

Page 32: Create cloud service on AWS

Data layer HA

Availability Zone a

RDS DB

instance

ElastiCache

node 1

Availability Zone b

S3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

server

RDS DB

standby

ElastiCache

node 2

Page 33: Create cloud service on AWS

User sessions

• Problem: Often stored on local disk

(not shared)

• Quickfix: ELB Session stickiness

• Solution: DynamoDB

Elastic Load

Balancing

Web

serverWeb

server

Logged in Logged out

Page 34: Create cloud service on AWS

Amazon DynamoDB

• Managed document and key-value store

• Simple to launch and scale

• To millions of IOPS

• Both reads and writes

• Consistent, fast performance

• Durable: perfect for storage of session data

https://github.com/aws/aws-dynamodb-session-tomcat

http://docs.aws.amazon.com/aws-sdk-php/guide/latest/feature-dynamodb-session-handler.html

Page 35: Create cloud service on AWS

Day 4 – Let’s go!

Page 36: Create cloud service on AWS

Replace guesswork with elastic IT

Startups pre-AWS

Demand

Unhappy Customers

Waste $$$

Traditional

Capacity

Capacity

Demand

AWS Cloud

Page 37: Create cloud service on AWS

Scaling the web tier

Availability Zone a

RDS DB

instance

ElastiCache

node 1

Availability Zone b

S3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

server

RDS DB

standby

ElastiCache

node 2

Page 38: Create cloud service on AWS

Scaling the web tier

Availability Zone a

RDS DB

instance

ElastiCache

node 1

Availability Zone b

S3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

server

RDS DB

standby

ElastiCache

node 2

Web

server

Web

server

Page 39: Create cloud service on AWS

Scaling the web tier

Availability Zone a

RDS DB

instance

ElastiCache

node 1

Availability Zone b

S3 bucket for

static assets

www.example.com

Amazon Route 53

DNS service

Elastic Load

Balancing

Web

serverWeb

server

RDS DB

standby

ElastiCache

node 2

Web

server

Web

server

Page 40: Create cloud service on AWS

Automatic resizing of compute

clusters based on demand

Feature Details

Control Define minimum and maximum instance pool sizes and when scaling and cool down occurs.

Integrated to Amazon CloudWatch

Use metrics gathered by CloudWatch to drive scaling.

Instance types Run Auto Scaling for on-demand and Spot Instances. Compatible with VPC.

aws autoscaling create-auto-scaling-group

--auto-scaling-group-name MyGroup

--launch-configuration-name MyConfig

--min-size 4

--max-size 200--availability-zones us-west-2c, us-west-2b

Auto Scaling Trigger auto-scaling policy

Amazon

CloudWatch

Page 41: Create cloud service on AWS
Page 42: Create cloud service on AWS

Sanlih E-Television Uses AWS to Support

Online Strategy

Sanlih E-Television is a nationwide cable TV

network delivering some of the most popular TV

channels in Taiwan.

I estimate that we’ve saved

30% by selecting AWS over

other cloud service

providers.

Andy Wang

Chief Information Officer, Sanlih E-Television

“ • Wanted to take advantage of online and streaming

platforms to build on leading position in the market

• Had to ensure IT infrastructure could handle demand

and deliver content

• Began running streaming service, website and mobile

apps on AWS

• Successfully integrated internet and mobile into

channel mix

• Saved time and money due to stability of AWS

platform and competitive pricing of services

Page 43: Create cloud service on AWS

Netflix Delivers Billions of Hours of Content per Month Using AWS.

Netflix is one of the world’s leading Internet television

network with over 57 million members in nearly 50

countries.

Our success with AWS can be

attributed to the scalability,

elasticity, and global availability of

AWS services.

Eva Tse

Director, Big Data Platform , Netflix

“ • Needed flexible IT infrastructure to experiment,

analyze, and grow its business worldwide.

• Using AWS to measure its users’ streaming

experiences through its analytics platform.

• Reports a reduction from weeks to seconds in testing

time for new features.

• Netflix operates a 10 PB data ‘warehouse’ on Amazon

S3 comprised of hundreds of millions of objects.

• Designed to deliver billions of hours of content

monthly using tens of thousands of instances across

three regions.

Page 44: Create cloud service on AWS

Decompose into small,

loosely coupled, stateless

building blocks

Prerequisite

Page 45: Create cloud service on AWS

What does this mean in practice?

• Only store transient data on local disk

• Needs to persist beyond a single http request?

– Then store it elsewhere

User uploads

User Sessions

Amazon S3

AWS DynamoDB

Application Data

Amazon RDS

Page 46: Create cloud service on AWS

Having decomposed into

small, loosely coupled,

stateless building blocks

You can now Scale out with ease

Having done that…

Page 47: Create cloud service on AWS

Having decomposed into

small, loosely coupled,

stateless building blocks

We can also Scale back with ease

Having done that…

Page 48: Create cloud service on AWS

Take the shortcut

• While this architecture is simple you still need

to deal with: – Configuration details

– Deploying code to multiple instances

– Maintaining multiple environments (Dev, Test, Prod)

– Maintain different versions of the application

• Solution: Use AWS Elastic Beanstalk

Page 49: Create cloud service on AWS

AWS Elastic Beanstalk (EB)

• Easily deploy, monitor, and scale three-tier web

applications and services.

• Infrastructure provisioned and managed by EB

• You maintain control.

• Preconfigured application containers

• Easily customizable.

• Support for these platforms:

Page 50: Create cloud service on AWS

Day 5 – Add more features

Page 51: Create cloud service on AWS

Mobile

Push

NotificationsMobile

AnalyticsCognito

Cognito

Sync

Analytics

KinesisData

PipelineRedShift EMR

Your Applications

AWS Global Infrastructure

Network

VPCDirect

ConnectRoute 53

Storage

EBS S3 Glacier CloudFront

Database

DynamoDBRDS ElastiCache

Deployment & Management

Elastic

BeanstalkOpsWorks

Cloud

Formation

Code

Deploy

Code

Pipeline

Code

Commit

Security & Administration

CloudWatch ConfigCloud

TrailIAM Directory KMS

Application

SQS SWFApp

Stream

Elastic

TranscoderSES

Cloud

Search

SNS

Enterprise Applications

WorkSpaces WorkMail WorkDocs

Compute

EC2 ELBAuto

ScalingLambdaECS

Page 52: Create cloud service on AWS

AWS building blocks

Inherently Scalable & Highly Available Scalable & Highly Available

Elastic Load Balancing

Amazon CloudFront

Amazon Route53

Amazon S3

Amazon SQS

Amazon SES

Amazon CloudSearch

AWS Lambda

Amazon DynamoDB

Amazon Redshift

Amazon RDS

Amazon Elasticache

Amazon EC2

Amazon VPC

Automated Configurable With the right architecture

Page 53: Create cloud service on AWS

Stay focused as you scale your team

AWSCloud-Based

Infrastructure

YourBusiness

More Time to Focus onYour Business

Configuring Your Cloud Assets

70%

30%70%

On-PremiseInfrastructure

30%

Managing All of the “Undifferentiated Heavy Lifting”

Page 54: Create cloud service on AWS

Summary

Page 55: Create cloud service on AWS

Amazon Route 53

DNS serviceNo limit

Availability Zone a

RDS DB

instance

ElastiCache

node 2

Availability Zone b

S3 bucket for

static assets

www.example.com

Elastic Load

Balancing

RDS DB

standby ElastiCache

node 3

RDS read

replicaRDS read

replica

DynamoDB

RDS read

replicaElastiCache

node 4

RDS read

replicaElastiCache

node 1

CloudSearchLambdaSES SQS

Page 56: Create cloud service on AWS

A quick review

• Keep it simple and stateless

• Make use of managed self-scaling services

• Multi-AZ and AutoScale your EC2 infrastructure

• Use the right DB for each workload

• Cache data at multiple levels

• Simplify operations with deployment tools

Page 57: Create cloud service on AWS

Next steps?

READ!

• aws.amazon.com/documentation

• aws.amazon.com/architecture

ASK FOR HELP!

• forums.aws.amazon.com

• aws.amazon.com/support

Page 58: Create cloud service on AWS

Q&A