AWS: Scaling With Elastic Beanstalk

47
AWS: SCALING WITH ELASTIC BEANSTALK AN LE PHU NGUYEN DECEMBER 2OTH, 2014

Transcript of AWS: Scaling With Elastic Beanstalk

Page 1: AWS: Scaling With Elastic Beanstalk

AWS: SCALING WITH ELASTIC BEANSTALK

AN LE PHU NGUYEN

DECEMBER 2OTH, 2014

Page 2: AWS: Scaling With Elastic Beanstalk

$ WHOAMI

Nguyễn Lê Phú An

Senior Software Engineer

R&D, KMS Technology Inc.

[email protected]

AWS: SCALING WITH ELASTIC BEANSTALK

An Nguyen

Page 3: AWS: Scaling With Elastic Beanstalk

LET’S DESCRIBE YOURSELF

What is AWS?

I heard that before

I’m working on that

I’m a guru!

AWS: SCALING WITH ELASTIC BEANSTALK

Page 4: AWS: Scaling With Elastic Beanstalk

WHAT IS AWS?

• Amazon Web Services

• Provides cloud computing infrastructure

• Started with hosting services and then…

AWS: SCALING WITH ELASTIC BEANSTALK

Page 5: AWS: Scaling With Elastic Beanstalk

AGENDA

AWS: SCALING WITH ELASTIC BEANSTALK

Elastic Beanstalk

Deployment & Scaling

Zonal & Regional Load Balancing

Takeaways

Page 6: AWS: Scaling With Elastic Beanstalk

What is Elastic Beanstalk?

AWS: SCALING WITH ELASTIC BEANSTALK

Page 7: AWS: Scaling With Elastic Beanstalk

ELASTIC BEANSTALK

ELASTIC BEANSTALK

Page 8: AWS: Scaling With Elastic Beanstalk

ELASTIC BEANSTALK

ELASTIC BEANSTALK

Elas

tic

Bea

nst

alk

EC2 Instances

Elastic Load Balancer

Auto Scaling Group

Page 9: AWS: Scaling With Elastic Beanstalk

EC2 – ELASTIC COMPUTE CLOUD

ELASTIC BEANSTALK

Page 10: AWS: Scaling With Elastic Beanstalk

AUTO SCALING GROUP

ELASTIC BEANSTALK

• Scales EC2 instances up or down automatically with your conditions

Page 11: AWS: Scaling With Elastic Beanstalk

ELASTIC LOAD BALANCER

ELASTIC BEANSTALK

• Routes traffic across multiple instances

• Auto scaling

• Integrates to Security Group and SSL

Page 12: AWS: Scaling With Elastic Beanstalk

ELASTIC BEANSTALK

ELASTIC BEANSTALK

• EC2 Instances

• Auto Scaling Group

• Elastic Load Balancer

• Security Group

• DB

Page 13: AWS: Scaling With Elastic Beanstalk

Deployment & Scaling

AWS: SCALING WITH ELASTIC BEANSTALK

Page 14: AWS: Scaling With Elastic Beanstalk

FIRST STEPS

DEPLOYMENT & SCALING

Page 15: AWS: Scaling With Elastic Beanstalk

CREATE ELASTIC BEANSTALK

DEPLOYMENT & SCALING

Page 16: AWS: Scaling With Elastic Beanstalk

ZIP AND UPLOAD YOUR PROJECT

DEPLOYMENT & SCALING

Page 17: AWS: Scaling With Elastic Beanstalk

CREATE DATABASE

DEPLOYMENT & SCALING

Page 18: AWS: Scaling With Elastic Beanstalk

DEFINE ENVIROMENT

DEPLOYMENT & SCALING

Page 19: AWS: Scaling With Elastic Beanstalk

MONITOR

DEPLOYMENT & SCALING

Page 20: AWS: Scaling With Elastic Beanstalk

ALARM

DEPLOYMENT & SCALING

Page 21: AWS: Scaling With Elastic Beanstalk

How about next deployment?

DEPLOYMENT & SCALING

Page 22: AWS: Scaling With Elastic Beanstalk

NEXT DEPLOYMENT: AWS CLI

• Install AWS Command Line Interface

• Setup AWSDevTools

• git aws.config

• git aws.push (it will push the entire repo)

Updating the AWS Elastic Beanstalk environment staging-sample...

Environment update initiated successfully.

DEPLOYMENT & SCALING

Read more here: http://aws.amazon.com/code/6752709412171743

Page 23: AWS: Scaling With Elastic Beanstalk

LOGGING

DEPLOYMENT & SCALING

Page 24: AWS: Scaling With Elastic Beanstalk

How about scaling?

DEPLOYMENT & SCALING

Page 25: AWS: Scaling With Elastic Beanstalk

HOW ABOUT SCALING?

• Configure Auto Scaling Group

• Define the trigger

• Let him do his job!

DEPLOYMENT & SCALING

Page 26: AWS: Scaling With Elastic Beanstalk

SETUP AUTO SCALING

DEPLOYMENT & SCALING

Page 27: AWS: Scaling With Elastic Beanstalk

SETUP SCALING TRIGGER

DEPLOYMENT & SCALING

Page 28: AWS: Scaling With Elastic Beanstalk

DASHBOARD

DEPLOYMENT & SCALING

Page 29: AWS: Scaling With Elastic Beanstalk

Elastic Beanstalk Setup Demo

DEPLOYMENT & SCALING

Page 30: AWS: Scaling With Elastic Beanstalk

PRICING

• There is no additional charge for Elastic Beanstalk – you only pay for the underlying AWS resources

• Try AWS free usage tier!

DEPLOYMENT & SCALING

Page 31: AWS: Scaling With Elastic Beanstalk

SOME GOOD PRACTICES

• Make your app scalable first

– Share your static resources: video, image, css, js…

• S3, CloudFront are good candidates

– Share database and cache servers

• RDS, DynamoDB, ElastiCache

• Control auto scaling group to control your bill

– Limit Max instance number

– Add notification, at least when to Add/Remove instance

– Adjust trigger frequently according your website’s workload

DEPLOYMENT & SCALING

Page 32: AWS: Scaling With Elastic Beanstalk

SHOULD I USE EB?

• Pros:

– Super easy to deploy

– Separate environments

– Integrate to other AWS services

– Good organization

• Cons:

– Quite slow deployment with large repo

– Be careful with auto scaling

– Hard to customize EC2 instances

DEPLOYMENT & SCALING

Page 33: AWS: Scaling With Elastic Beanstalk

MORE…

• CloudWatch

– Monitor & Notification

• CloudFront

– Share web static resource (CDN)

• RDS, DynamoDB & ElastiCache

– Database & Cache

• S3

– File storage

• DB backup

• Deployment files

DEPLOYMENT & SCALING

Page 34: AWS: Scaling With Elastic Beanstalk

Zonal & Regional load balancing

AWS: SCALING WITH ELASTIC BEANSTALK

Page 35: AWS: Scaling With Elastic Beanstalk

REGIONS

ZONAL & REGIONAL LOAD BALANCING

Page 36: AWS: Scaling With Elastic Beanstalk

AVAILABILITY ZONES

ZONAL & REGIONAL LOAD BALANCING

Page 37: AWS: Scaling With Elastic Beanstalk

ZONAL LOAD BALANCING

ZONAL & REGIONAL LOAD BALANCING

Page 38: AWS: Scaling With Elastic Beanstalk

ENABLE ZONAL LOAD BALANCING & SCALING

ZONAL & REGIONAL LOAD BALANCING

Sounds good! Will it scale my databases, cache

services?

In Elastic Load Balancer

In Auto Scaling Group

Page 39: AWS: Scaling With Elastic Beanstalk

How about regional load balancing?

ZONAL & REGIONAL LOAD BALANCING

Page 40: AWS: Scaling With Elastic Beanstalk

REGION LOAD BALANCING

ZONAL & REGIONAL LOAD BALANCING

Page 41: AWS: Scaling With Elastic Beanstalk

ROUTE 53

ZONAL & REGIONAL LOAD BALANCING

• A Domain Name System (DNS)

• Connect user to services: EC2, S3,

Elastic Load Balancer, CloudFront

• Auto scale

• Health check mechanism

• DNS Failover

Page 42: AWS: Scaling With Elastic Beanstalk

ROUTE 53

ZONAL & REGIONAL LOAD BALANCING

Page 43: AWS: Scaling With Elastic Beanstalk

MORE…

• Database, cache replication

– Cross-zone

– Cross-region

• Route 53 configuration

– Latency based routing

– Geo DNS

ZONAL & REGIONAL LOAD BALANCING

Page 44: AWS: Scaling With Elastic Beanstalk

TAKEAWAYS

AWS: SCALING WITH ELASTIC BEANSTALK

Page 45: AWS: Scaling With Elastic Beanstalk

TAKEAWAYS

• Elastic Beanstalk

– Combination of ELB, Auto Scaling Group, EC2 and some services

– Auto Scale configuration

– Pros & Cons

• Cross-zone & Cross-region

– Enable cross-zone load balancing & scaling

– Use Route 53 to handle cross-region load balancing

AWS: SCALING WITH ELASTIC BEANSTALK

Page 46: AWS: Scaling With Elastic Beanstalk

Q&A

AWS: SCALING WITH ELASTIC BEANSTALK

Page 47: AWS: Scaling With Elastic Beanstalk

THANK YOU

© 2013 KMS Technology