Agile Deployment using Git and AWS Elastic Beanstalk

Post on 21-Apr-2017

377 views 0 download

Transcript of 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 – alexjs@amazon.com

Web Services

APP DEPLOYMENT ENVIRONMENTS INFRASTRUCTURE

What if you could just focus on your app ?

APPand a TOOLBOX for

DEPLOYMENT, ENVIRONMENTS and INFRASTRUCTURE

You can, with AWS Elastic Beanstalk!

APP AWS Elastic Beanstalk

Okay let’s get started!

Components of a Web App

• Three tier architecture:

• Web Server

• App Server

• Database

• Components

• Application Compute

• Database Engine

• Storage and Delivery

Components of a Web App

• Three tier architecture:

• Web Server

• App Server

• Database

• Components

• Application Compute

• Database Engine

• Storage & Delivery

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.

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

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!

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

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

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

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

Live Demo

http://bit.ly/summit2016-helloworld

Hello world

Lets build a simple chat app!

• Scalable and Highly Available

Lets build a simple chat app!

• Scalable and Highly Available

• Database

Lets build a simple chat app!

• Scalable and Highly Available

• Database

• WebSockets

Lets build a simple chat app!

• 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!

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

Live Demo

http://bit.ly/summit2016-simplechat

Components of a Web App

• Three tier architecture:

• Web Server

• App Server

• Database

• Components

• Application Compute

• Database Engine

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

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

Live Demo

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

Simple Chat with a database

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

Multi-AZ - High Availability SetupAvailability Zone A - Fails

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

Multi-AZ - High Availability SetupSlave is promoted to Master

Starts accepting traffic

from Application

Multi-AZ - High Availability SetupAuto scaling Kicks In

Spins up App Server instance

to maintain the min

count of 2

WebSockets over multiple nodes?

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

New branch: Simple Chat + DB + Redis

Live Demo

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

2 Environments

PROD

STAGING

Blue/Green Deployments

Blue/Green Deployments

Blue/Green Deployments

Blue/Green Deployments

Live Demo

AWS Elastic Beanstalk

• Deploy and maintain complete

control over my environment.

• Focus on my app

• Git + EB CLI

Smooth sailing from now on

Thank You