Agile Deployment using Git and AWS Elastic Beanstalk

46
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. May 2016 Agile Deployment using Git and AWS Elastic Beanstalk Alex Smith - @alexjs [email protected]

Transcript of Agile Deployment using Git and AWS Elastic Beanstalk

Page 1: Agile Deployment using Git and AWS Elastic Beanstalk

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

May 2016

Agile Deployment using Git and

AWS Elastic Beanstalk

Alex Smith - @alexjs – [email protected]

Page 2: Agile Deployment using Git and AWS Elastic Beanstalk

Web Services

APP DEPLOYMENT ENVIRONMENTS INFRASTRUCTURE

Page 3: Agile Deployment using Git and AWS Elastic Beanstalk

What if you could just focus on your app ?

APPand a TOOLBOX for

DEPLOYMENT, ENVIRONMENTS and INFRASTRUCTURE

Page 4: Agile Deployment using Git and AWS Elastic Beanstalk

You can, with AWS Elastic Beanstalk!

APP AWS Elastic Beanstalk

Page 5: Agile Deployment using Git and AWS Elastic Beanstalk

Okay let’s get started!

Page 6: Agile Deployment using Git and AWS Elastic Beanstalk

Components of a Web App

• Three tier architecture:

• Web Server

• App Server

• Database

• Components

• Application Compute

• Database Engine

• Storage and Delivery

Page 7: Agile Deployment using Git and AWS Elastic Beanstalk

Components of a Web App

• Three tier architecture:

• Web Server

• App Server

• Database

• Components

• Application Compute

• Database Engine

• Storage & Delivery

Page 8: Agile Deployment using Git and AWS Elastic Beanstalk

AWS Elastic Beanstalk - EB

• Easily deploy, monitor, and scale applications.

• Infrastructure provisioned and managed by EB.

You maintain complete control.

• Preconfigured application containers that are

easily customisable.

Page 9: Agile Deployment using Git and AWS Elastic Beanstalk

AWS Elastic Beanstalk Environment

• Two tiers:

• Web Server

• Worker

• Two types:

• Single instance

• Load balanced, auto scaling

• Configures Amazon Route 53

and provides a domain name

https://yourapp.elasticbeanstalk.com

Page 10: Agile Deployment using Git and AWS Elastic Beanstalk

Application Versioning

Saved Configurations

Allow for easy duplication for

A/B testing or non-disruptive

deployments

Application Versions

All versions are stored

durably in Amazon S3.

Code can also be pushed

from a Git repository!

Page 11: Agile Deployment using Git and AWS Elastic Beanstalk

AWS Elastic Beanstalk Instance Configuration

Your code

HTTP server

Application server

Language interpreter

Operating system

Host

• Each Amazon EC2

instance comes with the

necessary components

to run applications

• No more worrying about

logging into instances to

install and configure your

app stack

Focus on building your app

Page 12: Agile Deployment using Git and 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

$ pip install awsebcli

Page 13: Agile Deployment using Git and AWS Elastic Beanstalk

Example: CLI workflow

Initial app deployment:

$ 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 14: Agile Deployment using Git and AWS Elastic Beanstalk

Example: CLI workflow

Update your app:

Update your code01

$ git add .$ git commit –m "v2.0"$ eb deploy

Push the new code 02

Monitor the deployment progress03

$ eb status

Page 15: Agile Deployment using Git and AWS Elastic Beanstalk

Live Demo

http://bit.ly/summit2016-helloworld

Page 16: Agile Deployment using Git and AWS Elastic Beanstalk

Hello world

Page 17: Agile Deployment using Git and AWS Elastic Beanstalk

Lets build a simple chat app!

Page 18: Agile Deployment using Git and AWS Elastic Beanstalk

• Scalable and Highly Available

Lets build a simple chat app!

Page 19: Agile Deployment using Git and AWS Elastic Beanstalk

• Scalable and Highly Available

• Database

Lets build a simple chat app!

Page 20: Agile Deployment using Git and AWS Elastic Beanstalk

• Scalable and Highly Available

• Database

• WebSockets

Lets build a simple chat app!

Page 21: Agile Deployment using Git and AWS Elastic Beanstalk

• Scalable and Highly Available

• Database

• WebSockets

Lets use a web framework: SailsJS

“The web framework of your dreams.

Built for developers by developers.”http://sailsjs.org

Lets build a simple chat app!

Page 22: Agile Deployment using Git and AWS Elastic Beanstalk

Customisation via .ebextensions

• Customize AWS Elastic Beanstalk resources

• Examples:

• Deploy your resources in a custom VPC

• Configure your auto-scaling rules

• Much more

• Simple Chat:

• Custom VPC

• Configure ELB for websockets

Page 23: Agile Deployment using Git and AWS Elastic Beanstalk

Live Demo

http://bit.ly/summit2016-simplechat

Page 24: Agile Deployment using Git and AWS Elastic Beanstalk

Components of a Web App

• Three tier architecture:

• Web Server

• App Server

• Database

• Components

• Application Compute

• Database Engine

Page 25: Agile Deployment using Git and AWS Elastic Beanstalk

Amazon RDS

Amazon RDS

• Fully managed relational database

• Automated full daily backups and 5 min

incremental point in time recovery

• Highly available through Multi-AZ with

automatic failover to standby database

• Easily create cross-region read replicas

• Managed underlying storage layer with

configurable IOPS performance

Aurora MariaDB

Page 26: Agile Deployment using Git and AWS Elastic Beanstalk

Using Elastic Beanstalk with Amazon RDS

• Support for running Amazon RDS instances in your AWS Elastic

Beanstalk environment.

• RDS connection details are made available to application as

environment variables

• Database is tied to

beanstalk environment’s

lifecycle

Page 27: Agile Deployment using Git and AWS Elastic Beanstalk

Live Demo

http://bit.ly/summit2016-simplechat-rds

Page 28: Agile Deployment using Git and AWS Elastic Beanstalk

Simple Chat with a database

Page 29: Agile Deployment using Git and AWS Elastic Beanstalk

Multi-AZ - High Availability SetupA Simple Multi-AZ Setup

Page 30: Agile Deployment using Git and AWS Elastic Beanstalk

Multi-AZ - High Availability SetupAvailability Zone A - Fails

Page 31: Agile Deployment using Git and AWS Elastic Beanstalk

Multi-AZ - High Availability SetupRDS Multi-AZ Failover Kicks In

Page 32: Agile Deployment using Git and AWS Elastic Beanstalk

Multi-AZ - High Availability SetupSlave is promoted to Master

Starts accepting traffic

from Application

Page 33: Agile Deployment using Git and AWS Elastic Beanstalk

Multi-AZ - High Availability SetupAuto scaling Kicks In

Spins up App Server instance

to maintain the min

count of 2

Page 34: Agile Deployment using Git and AWS Elastic Beanstalk

WebSockets over multiple nodes?

Page 35: Agile Deployment using Git and AWS Elastic Beanstalk

Amazon ElastiCache

Amazon ElastiCache

• Fully managed in-memory cache

• Dynamically add or remove cache nodes

• Memcached and Redis

• Cache node auto-discovery

• Multi-AZ node

placement

• Multi-AZ with

auto-failover

• Persistence

• Read replicas

Page 36: Agile Deployment using Git and AWS Elastic Beanstalk

New branch: Simple Chat + DB + Redis

Page 37: Agile Deployment using Git and AWS Elastic Beanstalk

Live Demo

http://bit.ly/summit2016-simplechat-redis

Page 38: Agile Deployment using Git and AWS Elastic Beanstalk

2 Environments

PROD

STAGING

Page 39: Agile Deployment using Git and AWS Elastic Beanstalk

Blue/Green Deployments

Page 40: Agile Deployment using Git and AWS Elastic Beanstalk

Blue/Green Deployments

Page 41: Agile Deployment using Git and AWS Elastic Beanstalk

Blue/Green Deployments

Page 42: Agile Deployment using Git and AWS Elastic Beanstalk

Blue/Green Deployments

Page 43: Agile Deployment using Git and AWS Elastic Beanstalk

Live Demo

Page 44: Agile Deployment using Git and AWS Elastic Beanstalk

AWS Elastic Beanstalk

• Deploy and maintain complete

control over my environment.

• Focus on my app

• Git + EB CLI

Page 45: Agile Deployment using Git and AWS Elastic Beanstalk

Smooth sailing from now on

Page 46: Agile Deployment using Git and AWS Elastic Beanstalk

Thank You