aws re:invent 2016: scaling your web applications with aws elastic beanstalk (dev206)

59
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Jeff Hoffman | Director, Software Development | AWS Elastic Beanstalk Adhiraj Singh | Sr. Product Manager | AWS Elastic Beanstalk November 29, 2016 DEV206 Scaling Your Web Applications with AWS Elastic Beanstalk

Upload: amazon-web-services

Post on 06-Jan-2017

190 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

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

Jeff Hoffman | Director, Software Development | AWS Elastic Beanstalk

Adhiraj Singh | Sr. Product Manager | AWS Elastic Beanstalk

November 29, 2016

DEV206

Scaling Your Web Applications with

AWS Elastic Beanstalk

Page 2: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Agenda

• Elastic Beanstalk Introduction

• Elastic Beanstalk vs. DIY

• Getting started with Elastic Beanstalk

• Demo – Sample Application

• Best Practices

• Deployment options

• Managed Updated

• Auto Scaling

• Other tips

Page 3: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Developer challenges

• Complexity of deploying code, provisioning

and managing infrastructure

• Expertise and time needed to manage and

configure servers, databases, load

balancers, firewalls, and networks

• How to automate application scaling

• Lack of consistency across teams

Page 4: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

What is Elastic Beanstalk?

AWS Elastic Beanstalk is an easy-to-use service for

deploying, scaling, and managing web applications and

services.

Page 5: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

AWS Elastic Beanstalk vs. Do It Yourself

Your code

HTTP Server

Application Server

Language Interpreter

Operating System

Host

Elastic Beanstalk configures each

EC2 instance in your

environment with the components

necessary to run applications for

the selected platform.

Focus on building your

application

Provided by you

Provided and managed by AWS Elastic Beanstalk (EB)

On-instance configuration

Page 6: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

AWS Elastic Beanstalk vs. Do It Yourself

• Preconfigured Infrastructure

• Single Instance (Dev, Low Cost)

• Load Balanced, Auto Scaling (Production)

• Web & Worker tiers

• Elastic Beanstalk provisions necessary

infrastructure resources such as the load

balancer, Auto Scaling group, security

groups, database (optional), etc.

• Provides a unique domain name for your

application

(e.g.: youapp.regionx.elasticbeanstalk.com)

Infrastructure stack

Page 7: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Elastic Beanstalk benefits

Fast & simple

to begin

Developer

productivity/agility

Impossible

to outgrow

Complete

resource control

No additional charge to use Elastic Beanstalk.

You pay only for underlying AWS resources (i.e., EC2 instances, S3, etc.)

Page 8: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Common use cases

WebsitesAPI

backends

Mobile

backendsAsynchronous

Workers

Page 9: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

How do I get started with Elastic Beanstalk?

Page 10: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Information required to deploy application

01

02

03

04

Region

Stack (container) type

Single InstanceLoad Balanced with

Auto ScalingOR

Database (RDS)

Your code

Optional

Supported Platforms

Page 11: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Building blocks

Application

Application Versions ( V1, V2, …,Vx)

Environment 1

Environment 2

Environment .. n

Page 12: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

How to deploy applications

1. Via AWS Management Console

2. Via AWS Toolkit for Eclipse and Visual

Studio IDE

3. Via AWS SDKs and CLI

4. Via EB command line interface

$ eb deploy

Page 13: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Deploy sample application (EB CLI)

Initial application deployment workflow

$ git clone https://github.com/awslabs/eb-node-express-sample.git

Download sample application02

$ eb init

Create your Elastic Beanstalk app03

Follow the prompts to configure the

environment04

05 Create the resources and launch the

application

$ eb create

$ pip install --upgrade awsebcli

Install the AWS Elastic Beanstalk

command line interface (EB CLI)

01

Page 14: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Update sample application (EB CLI)

Update application workflow

Update your code01

$ git add .$ git commit –m “v2.0”$ eb deploy

Add & commit code to repository02

Open application once deployment

completes

03

$ eb open

Page 15: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Sample application details

• Application dependency management

• Configuring/customizing an environment using ebextensions

• Choosing a remote source repository: AWS CodeCommit

• Adding additional AWS resources (e.g.: DynamoDB, SNS, SQS, etc.)

Page 16: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Demo

Page 17: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)
Page 18: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Best practices

• Deployment options

• Managed Platform Updates

• Auto Scaling

• Load test your application

• Other tips

Page 19: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Deployment options

* Default method ^ ”All at Once” Method used

Environment Type Deployment category Method

All at Once*

Immutable (New)

Disabled*^

Immutable (New)

All at Once

Rolling*

Rolling with additional batch

Immutable

Disabled^

Rolling based on Health*

Rolling based on Time

Immutable

Single Instance

Load Balanced/Auto-Scaled

Application

Platform/Configuration

Application

Platform/Configuration

Page 20: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

All at once: step 0

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 21: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

All at once: step 1

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 22: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

All at once: step 2

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 23: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling: step 0

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 24: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling: step 1

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 25: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling: step 2

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 26: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling: step 3

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 27: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling: step 4

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 28: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 0

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 29: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 1

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2 v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 30: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 2

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2 v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 31: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 3

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2 v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 32: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 4

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2 v2 v2

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 33: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 5

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2 v2 v2

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 34: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 6

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2 v2 v2

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 35: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Rolling with additional batch: step 7

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 36: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 0

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 37: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 1

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Auto Scaling Group

v2

Page 38: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 2

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Auto Scaling Group

v2

Page 39: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 3

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Auto Scaling Group

v2 v2 v2v2

Page 40: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 4

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Auto Scaling Group

v2 v2 v2v2

Page 41: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 5

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Auto Scaling Group

v2 v2 v2v2

Page 42: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 6

Elastic Beanstalk Environment

myapp.us-east-1.elasticbeanstalk.com

Auto Scaling Group

v2 v2 v2v2

Page 43: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Immutable: step 6

Auto Scaling Group

Elastic Beanstalk Environment

v2 v2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 44: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 0

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Page 45: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 1

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp_new.us-east-1.elasticbeanstalk.com

v1v1

Cloned environment

Page 46: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 2

Auto Scaling Group

Elastic Beanstalk Environment

v2 V2

myapp_new.us-east-1.elasticbeanstalk.com

v2v2

Cloned environment

Page 47: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 3

Cloned environment

Auto Scaling Group

Elastic Beanstalk Environment

v2 V2

myapp_new.us-east-1.elasticbeanstalk.com

v2v2

Page 48: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 4

Page 49: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 5

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp.us-east-1.elasticbeanstalk.com

v1v1

Cloned environment

Auto Scaling Group

Elastic Beanstalk Environment

v2 V2

myapp_new.us-east-1.elasticbeanstalk.com

v2v2

Page 50: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Blue/Green: step 6

Auto Scaling Group

Elastic Beanstalk Environment

v1 v1

myapp_new.us-east-1.elasticbeanstalk.com

v1v1

Cloned environment

Auto Scaling Group

Elastic Beanstalk Environment

v2 V2

myapp.us-east-1.elasticbeanstalk.com

v2v2

Page 51: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Application deployment options

Method Impact of failed deploymentDeploy

Time

Zero

Downtime

No DNS

Change

Rollback

process

Code

Deployed

To

All at Once Downtime X Re-deploy Existing

instances

Rolling Single batch out of service. Any

successful batches prior to

failure running new application

version

♦ Re-deploy Existing

instances

Rolling with

additional batch

Minimum if first batch fails,

otherwise similar to Rolling

♦ Re-deploy New &

existing

instances

Immutable Minimal Re-deploy New

instances

Blue/Green Minimal Swap URL New

instances

Options available for both Single Instance and Load Balanced/Auto-Scaled Environments ♦ Varies depending on instance batch size

Page 52: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Managed Platform Update

Configure your environment to automatically upgrade to the latest

version of a platform during a scheduled maintenance window.

• Permissions

• Maintenance Window

• Minor and Patch Updates

Key benefits:

• Automated Upgrades

• No/Minimal downtime

• No/Minimal impact on capacity

• Flexibility of manual updates

• Instance replacement

Page 53: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

DemoManaged updates

Page 54: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)
Page 55: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Auto Scaling

Min/Max instances

Availability Zones

Scaling cooldown

Triggers based scaling

Trigger measurement (CPU utilization, network traffic, disk activity, instance health)

Trigger statistic

Measurement period

Breach duration

Thresholds

Breach scale increment

Time-based scaling

Name

Min/Max instance

Occurrence (One-time, Recurrent)

Recurrence (CRON expression- 30 8 * * 3)

Page 56: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Other tips

Logs, Metrics, & Alarms• Enable log rotation to automatically publish logs to S3.

• Understand metrics available for your environment and what they mean.

• Set up alarms to automatically monitor critical metrics and send notifications when

metrics are outside normal operating range.

• Enable Amazon Route 53 health checks and alarms

Tag your environments• Makes it easy to find resources belonging to a given environment.

• Can be used to monitor costs associated with a given environment and/or

application.

• AWS Elastic Beanstalk automatically tags environments with:

• Environment Name

• Environment ID

Page 57: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Key linksElastic beanstalk resources:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/RelatedResources.html

Sample application:

https://github.com/awslabs/eb-node-express-sample

Troubleshooting tips:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/troubleshooting.html

Tutorials and samples:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/tutorials.html

Deployment options:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deploy-existing-version.html

Managed Updates:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-platform-update-managed.html

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-servicerole.html#iam-servicerole-update

Configuring Auto Scaling:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.as.html

Load Testing with Locust:

https://aws.amazon.com/blogs/devops/using-locust-on-aws-elastic-beanstalk-for-distributed-load-generation-and-testing/

https://github.com/awslabs/eb-locustio-sample

Tagging your Elastic Beanstalk resources:

http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.tagging.html

Page 58: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Thank you!

Page 59: AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk (DEV206)

Remember to complete

your evaluations!