deploy, manage, and scale your apps with aws elastic beanstalk

44
September 15 th , 2015 | AWS Pop Up Loft, London Andreas Chatzakis, Solutions Architect

Upload: amazon-web-services

Post on 16-Apr-2017

3.333 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

September 15th, 2015 | AWS Pop Up Loft, London

Andreas Chatzakis, Solutions Architect

Page 2: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 3: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Amazon Route 53

DNS service

Availability Zone a

RDS DB

instance

ElastiCache

node 1

Availability Zone b

S3 bucket for

static assets

www.example.com

Elastic Load

Balancing

RDS DB

standby ElastiCache

node 2

Page 4: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 5: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

You need to

deliver resilient

applications with

less work

Source: http://xkcd.com/844/

Page 6: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

AWS Elastic Beanstalk (EB)

Page 7: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Benefits of Elastic Beanstalk

Focus on your application

Focus on what makes your business unique

Focus on innovation, not undifferentiated heavy lifting

Spend developer time in the right place

Automate as much as you can

Page 8: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

There’s no additional charge for Elastic Beanstalk

Page 9: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Elastic Beanstalk object model

Application

Environments

• Infrastructure resources (such as EC2 instances, ELB load balancers, and Auto Scaling groups)

• Runs a single application version at a time for better scalability

• An application can have many environments (such as staging and production)

Application versions

• Application code

• Stored in Amazon S3

• An application can have many application versions (easy to rollback to previous versions)

Saved configurations

• Configuration that defines how an environment and its resources behave

• Can be used to launch new environments quickly or roll-back configuration

• An application can have many saved configurations

Page 10: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Elastic Beanstalk environment• Two types:

• Single instance

• Load balancing, auto scaling

• Two tiers (web server and worker)

• Elastic Beanstalk provisions necessary

infrastructure resources such as load

balancers, auto-scaling groups, security

groups, and databases (optional)

• Configures Amazon Route 53 and gives

you a unique domain name

(For example: yourapp.elasticbeanstalk.com)

Page 11: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

On-instance configuration

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

• No more worrying about

logging into instances to

install and configure your

application stack

Focus on building your

application

Page 12: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Application versions saved configurations

Saved configurationsSave these for easy duplication for

A/B testing or non-disruptive

deployments

Application versionsAll versions are stored durably

in Amazon S3. Code can also

be pushed from a Git repository!

Page 13: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Java PHP Python Ruby .NET Node.js

Docker

Page 14: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 15: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 16: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Alert

Log

Mon

Ap

p

AZ

EL

B

http://your-app.elasticbeanstalk.com

Page 17: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Alert

Log

Mon

Ap

p

AZ

http://your-app.elasticbeanstalk.com

Page 18: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Alert

Log

Mon

Ap

p

AZ

EL

B

http://your-app.elasticbeanstalk.com

Page 19: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Alert

Log

Mon

Ap

p

AZ

SQS queueProducers

Page 20: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Developer workflow

Page 21: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Deployment options

1. Via the AWS Management Console

2. Via Git / EB CLI

3. Via the AWS Toolkit for Eclipse and the

Visual Studio IDE

$ git aws.push

Page 22: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Deployment configuration

Region01

Stack (container) type02

Single instanceLoad balanced with

Auto Scaling03 OR

Database (RDS)04 Optional

Your code

Page 23: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Example: CLI workflow

• AWS account – your access and secret keys

• EB CLI

• Linux / Unix / Mac: Python 2.7 or 3.0

• Windows PowerShell 2.0

• A credential file

• Git 1.66 or later (optional)

Page 24: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Example: CLI workflow

$ git init . $ git add .

Initialize your Git repository01 Add your code04

$ eb init $ git commit –m “v1.0”

Create your Elastic Beanstalk app02 Commit05

Follow the prompts to configure the

environment03

Create the resources and launch the

application06

$ eb create

Page 25: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Example: CLI workflow

Update your code01

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

Push the new code 02

Monitor the deployment progress03

$ eb status

Page 26: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Example: Deploy Docker container to EB

Dockerfile

Dockerrun.aws.json

Page 27: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Example: Deploy Docker container to EB

$ git init .

Initialize your Git repository01

$ git add Dockerfile

Add your code04

$ eb init

Create your Elastic Beanstalk app02

$ git commit –am “v1.0”

Commit05

Follow the prompts to configure the

environment and copy Dockerfile03 06

Create the resources and launch the

application

$ eb create

Page 28: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 29: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Zero-downtime deployments

Rolling Deployments

1. EB detaches batch from ELB, Connection draining, Health Checks

2. EB reattaches batch to ELB and moves to next group of instances

Swap URLs

1. Create a new environment for an existing application

2. Deploy your updated application code to the new environment

3. Use the “Swap URLs” feature to transition users to the new

production environment

Page 30: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 31: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Alert

Log

Mon

Ap

p

AZ

EL

B

http://your-app.elasticbeanstalk.com

import os

some_var=os.environ.get(‘API_CREDS’)

String some_var = System.getProperty(‘API_CREDS’)

NameValueCollection appConfig = ConfigurationManager.AppSettings;

string param = appConfig[”API_CREDS"];

Python

Java

C#C#

Page 32: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Add custom software to your environment using ebextensions:

Customize application containers

packages:yum:

newrelic-sysmond: []rpm:

newrelic: http://yum.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm

commands:0_newrelic_command:

command: "touch /tmp/$(date '+%F.%T.%N').newrelic_command_0"1_configure_new_relic_key:

command: nrsysmond-config --set license_key=<Your key here>1a_newrelic_command:

command: "touch /tmp/$(date '+%F.%T.%N').newrelic_command_1a"2_start_new_relic:

command: "/etc/init.d/newrelic-sysmond start"2a_newrelic_command:

command: "touch /tmp/$(date '+%F.%T.%N').newrelic_command_2a"

Page 33: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 34: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 35: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Iterate on application architecture

Add additional resources to your environments using ebextensions:

Or use CloudFormation => assets independent of environment life time.

Add other components such as:

• In-memory caching (Amazon

ElastiCache Redis and

Memcached)

• Amazon SQS

• Amazon CloudFront

Resources:MyElastiCache:Type: AWS::ElastiCache::CacheClusterProperties:CacheNodeType:

Fn::GetOptionSetting:OptionName : CacheNodeTypeDefaultValue: cache.m1.small

NumCacheNodes: Fn::GetOptionSetting:OptionName : NumCacheNodesDefaultValue: 1

Engine: Fn::GetOptionSetting:OptionName : EngineDefaultValue: memcached

Page 36: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 37: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 38: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 39: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Elastic Beanstalk OpsWorks CloudFormation

Application container Application automation Templated provisioning

Page 40: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

AWS Code services

CodeCommit CodePipeline CodeDeploy

Page 41: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

MonitorProvisionDeployTestBuildCode

Elastic Beanstalk

OpsWorks

Cloud

Watch

Cloud

Formation

Code

Deploy

Code

Commit

Code

Pipeline

Page 42: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk
Page 43: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

http://amzn.to/10JK5dm

http://bit.ly/1o6PwZm

@aws_eb

Page 44: Deploy, Manage, and Scale your Apps with AWS Elastic Beanstalk

Thank you!