Top Banner
Building Agile Applications using Continuous Integration & Deployment on AWS Leo Zhadanovsky Senior Solutions Architect
99
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Building Agile Applications using

Continuous Integration & Deployment

on AWS

Leo Zhadanovsky

Senior Solutions Architect

Page 2: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CONTINUOUS

INTEGRATION

Page 3: AWS Webcast - Build Agile Applications in AWS Cloud for Government

What is Continuous Integration?

Changes to code automatically deployed to mainline branch• After passing unit and mock tests

Makes changes to code, and deployments iterative, not monolithic

Bugs are detected quickly

Allows rapid development

Helps automate deployments

Page 4: AWS Webcast - Build Agile Applications in AWS Cloud for Government

DEVELOPER

Page 5: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

Page 6: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

Page 7: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

Page 8: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

PICK

TASKS

Page 9: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

SUBMIT

CODE

Page 10: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

SCHEDULE

BUILD

Page 11: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

RECURRENT

BUILDS

Page 12: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

CODE

FETCH

Page 13: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

CODE QUALITY

TESTS

TEST

RESULTS

Page 14: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

BUILD OUTPUT

Page 15: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

DOCS

BINARIES

& PACKAGES

DEV FACING

NOTIFICATIONS

Page 16: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 17: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOURCE CODE

REPOSITORY

DNS

CONTINUOUS

INTEGRATION SERVER

PROJECT

MANAGEMENT SERVER

BUILDS

Page 18: AWS Webcast - Build Agile Applications in AWS Cloud for Government

New AWS Managed Options

CodeDeploy• Deploy your code to hundreds or thousands of instances

CodeCommit• AWS Managed Git Hosting

CodePipelines• AWS Managed Continuous Integration System

Page 19: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Cloud Software Development Lifecycle

10/13/14 19

MonitorProvisionDeployTestBuildCode

Elastic Beanstalk

OpsWorks

Cloud

Watch

Cloud

Formation

?

Page 20: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Why?

Customers are asking

Share Amazon tools and processes with customers

Showcase and integrate AWS partner tools

9/25/14 20

Page 21: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Source ControlPrivate Git repositories hosted on Amazon S3

Full Git compatibility (use with existing tools)

All the benefits of the cloud(scalable, durable, reliable, low pay as you go pricing)

No size limits on repositories (store binary files)

Online code tools with browse, edit, diff

10/13/14 21

Page 22: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 23: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Continuous DeliveryCustomizable release automation, with integrated build and test

Model and visualize custom release workflow(source build beta gamma prod)

Automate builds, tests, and deployments

Enforce custom rules, approvals, and gates

Integrate with third-party and custom tools

10/13/14 23

Page 24: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 25: AWS Webcast - Build Agile Applications in AWS Cloud for Government

DeploymentCoordinate software updates to fleets of EC2 instances

Rolling updates for no downtime

Deployment health checks and easy rollback

Auto Scaling integration

Works with any application

Reuse existing setup tools(Bash, Powershell, Chef, Puppet…)

10/13/14 25

Page 26: AWS Webcast - Build Agile Applications in AWS Cloud for Government

9/25/14 Slides not intended for

redistribution.

26

Page 27: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Cloud Software Development Lifecycle

10/13/14 27

MonitorProvisionDeployTestBuildCode

Elastic Beanstalk

OpsWorks

Cloud

Watch

Cloud

Formation

Code

Deploy

Code

Commit

Code

Pipeline

Page 28: AWS Webcast - Build Agile Applications in AWS Cloud for Government

PAIN POINTS• UNIT TESTS INCOMPLETE

• MOCK TESTS MAINTENANCE

• EXPENSIVE TEST ENVIRONMENT

• TEST ENVIRONMENT ≠ PRODUCTION

• DEPLOYMENT CYCLES

Page 29: AWS Webcast - Build Agile Applications in AWS Cloud for Government

ON-DEMAND

PAY AS YOU GO

ELASTIC

Page 30: AWS Webcast - Build Agile Applications in AWS Cloud for Government

=

PROGRAMMABLE

PLATFORM

Page 31: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 32: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 33: AWS Webcast - Build Agile Applications in AWS Cloud for Government

IF YOU CAN PROGRAM IT

YOU CAN AUTOMATE IT

Page 34: AWS Webcast - Build Agile Applications in AWS Cloud for Government

A lot of options…

Configuration Management Systems• Puppet• Chef• Saltstack

Deployment Frameworks• Elastic Beanstalk• OpsWorks• Ansible• Fabric• Capistrano

Infrastructure Management• CloudFormation

Page 35: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Bake an AMI Configure dynamically

Time consuming configuration (startup time)

Static configurations (less change management)

Bootstrapping

Page 36: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Bake an AMI Configure dynamically

Continuous deployment (latest code)

Environment specific (dev-test-prod)

Bootstrapping

Page 37: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Obama for America

awsofa.info

Page 38: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Web-Scale Applications

Page 39: AWS Webcast - Build Agile Applications in AWS Cloud for Government

500k+ IOPS DB Systems

Page 40: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Services API

Page 41: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 42: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Typical Charts

Page 43: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 44: AWS Webcast - Build Agile Applications in AWS Cloud for Government

How?

Page 45: AWS Webcast - Build Agile Applications in AWS Cloud for Government

IngredientsUbuntu nginx boundary Unity jQuery SQLServer hbase NewRelic

EC2 node.js Cybersource hive ElasticSearch Ruby Twilio EE S3

ELB boto Magento PHP EMR SES Route53 SimpleDB Campfire

nagios Paypal CentOS CloudSearch levelDB mongoDB python

securitygroups Usahidhi PostgresSQL Github apache bootstrap

SNS OpsView Jekyll RoR EBS FPS VPC Mashery Vertica RDS

Optimizely MySQL puppet tsunamiUDP R asgard cloudwatch

ElastiCache cloudopt SQS cloudinit DirectConnect BSD rsync STS

Objective-C DynamoDB

Page 46: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Infrastructure, Configuration Management & Monitoring

Ubuntu nginx boundary Unity jQuery SQLServer hbase NewRelic

EC2 node.js Cybersource hive ElasticSearch Ruby Twilio EE S3

ELB boto Magento PHP EMR SES Route53 SimpleDB Campfire

nagios Paypal CentOS CloudSearch levelDB mongoDB python

securitygroups Usahidhi PostgresSQL Github apache bootstrap

SNS OpsView Jekyll RoR EBS FPS VPC Mashery Vertica RDS

Optimizely MySQL puppet tsunamiUDP R asgard cloudwatch

ElastiCache cloudopt SQS cloudinit DirectConnect BSD rsync STS

Objective-C DynamoDB

Page 47: AWS Webcast - Build Agile Applications in AWS Cloud for Government

One thing that is difficult to prepare for…

Page 48: AWS Webcast - Build Agile Applications in AWS Cloud for Government

They had this built for the previous 3 months, all on the East Coast.

Page 49: AWS Webcast - Build Agile Applications in AWS Cloud for Government

They had this built for the previous 3 months, all on the East Coast.

We built this part in 9 hours to be safe.

AWS +Puppet +

Netflix Asgard + WAN Optimization Software +

DevOps =

Cross-Continent Fault-Tolerance On-Demand

Page 50: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Mozilla Foundation

Page 51: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Webmaker.org circa 2012

• Included Apps, non-SOA: Thimble, Popcorn, Goggles

• ~20 pushes of new software in 2012

• Operations and Development interacted mostly through bugzilla

tickets for deploys.

• Hosting in physical datacenter at Mozilla

Webmaker.org circa early 2013

• Deciding to go 12-factor, SOA in app layer

• Weekly pushes of Popcorn on train model

• Operations and Development interacted mostly through bugzilla

tickets for deploys.

Page 52: AWS Webcast - Build Agile Applications in AWS Cloud for Government

April 2013

Webmaker begins rebuilding entire platform

SOA, 12-factor in node.js exclusively

Moving apps into AWS and DevOps / CI

Page 53: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Since April 2013….Openbadges, Webmaker combine for: 1339 Pushes

Pushes Per Day to Staging / Prod

Pushes Per Day (Staging and Prod)

Page 54: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Who?

• ~30 Paid Developers

• Hundreds of Students

• Thousands of Contributors

• One DevOps / Internet Jedi

• Multiple Teams

How?

• Puppet, Jenkins, Fabric

• Tight feedback loops:

Newrelic, Opsview

• Culture Shift

• Staging Envs

• Brave devs iterate,

keeping work in-context

• Visible Ops

• Cross-train developers in

operations

Page 55: AWS Webcast - Build Agile Applications in AWS Cloud for Government

What changed?

Page 56: AWS Webcast - Build Agile Applications in AWS Cloud for Government

1) Know How You Were Doing Before

2) Know What Changed When

3) Know How You Are Now Doing

=

The confidence to try more things

and try them faster, with minimum

viable planning.

Page 57: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Deployment

Pipeline

Page 58: AWS Webcast - Build Agile Applications in AWS Cloud for Government

AWS

CLOUDFORMATIONSTACK-BASED DEPLOYMENT

SERVICE

Page 59: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CLOUDFORMATION

TEMPLATE

Page 60: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 61: AWS Webcast - Build Agile Applications in AWS Cloud for Government

{"Description" : "Create RDS with username and password","Resources" : {

"MyDB" : {"Type" : "AWS::RDS::DBInstance","Properties" : {

"AllocatedStorage" : "500","DBInstanceClass" : "db.m1.small","Engine" : "MySQL","EngineVersion" : "5.5","MasterUsername" : "MyName","MasterUserPassword" : "MyPassword"

}}

}}

Page 62: AWS Webcast - Build Agile Applications in AWS Cloud for Government

"AWS::CloudFormation::Init" : { "config" : {

"packages" : {"yum" : {

"mysql" : [],"mysql-server" : [],"httpd" : [],"php" : [],"php-mysql" : []

}},"sources" : {

"/var/www/html" :"https://s3.amazonaws.com/my-builds/build-v4.zip"

}}

Page 63: AWS Webcast - Build Agile Applications in AWS Cloud for Government

{"Parameters" : {"KeyName" : {

"Description" : "Name of an existing EC2KeyPair to enable SSHaccess to the instance",

"Type" : "String"}

},}

Page 64: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CLOUDFORMATION

TEMPLATE

PROCEDURAL

DEFINITIONCreate it programmatically

KNOWN

CONFIGURATIONStore stack configuration in

source control

PARAMETER

DRIVENDynamic and user-driven

templates

COLLABORATIONShare templates with ease

as just files

Page 65: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 66: AWS Webcast - Build Agile Applications in AWS Cloud for Government

APPLICATION

VERSIONS

+INFRASTRUCTURE

VERSIONS

Page 67: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CLOUDFORMATION

TEMPLATE

Page 68: AWS Webcast - Build Agile Applications in AWS Cloud for Government

LOAD TESTING

Page 69: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 70: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 71: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Benchmarking

Page 72: AWS Webcast - Build Agile Applications in AWS Cloud for Government

US-East Cache Node Performance 25.3 Gbps

Page 73: AWS Webcast - Build Agile Applications in AWS Cloud for Government

Only ~42MbpsImpact on US-East FMS Origin Servers

Page 74: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 75: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CONTINUOUS

DEPLOYMENTSMALL, FREQUENT CHANGES

CONSTANTLY INTEGRATING INTO

PRODUCTION.

Page 76: AWS Webcast - Build Agile Applications in AWS Cloud for Government

KEY = ITERATION

Page 77: AWS Webcast - Build Agile Applications in AWS Cloud for Government

ITERATION

=MODIFY THE SYSTEM TO BETTER

MEET THE EXPECTATIONS OF

YOUR USERS

Page 78: AWS Webcast - Build Agile Applications in AWS Cloud for Government

11.6s

Mean time

between

deployments

(weekday)

1,079

Max number of

deployments in a

single hour

10,000

Mean number of

hosts

simultaneously

receiving a

deployment

30,000

Max number of

hosts

simultaneously

receiving a

deployment

DEPLOYMENTS AT

AMAZON.COM

Page 79: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SOFTWARE DEPLOY

≠PRODUCT LAUNCH

Page 80: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 81: AWS Webcast - Build Agile Applications in AWS Cloud for Government

1.5 BILLION PAGE VIEWS

OCTOBER 2012

$83 MILLION IN TRANSACTIONS

4.2 MILLION ITEMS SOLD

Page 82: AWS Webcast - Build Agile Applications in AWS Cloud for Government

30 DEPLOYS PER DAY1 DEPLOY EVERY 20 MINUTES

Page 83: AWS Webcast - Build Agile Applications in AWS Cloud for Government

"Production is truly the only place you

can validate your code."

Page 84: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 85: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 86: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 87: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 88: AWS Webcast - Build Agile Applications in AWS Cloud for Government

DATA-DRIVEN

ARCHITECTURES

Page 89: AWS Webcast - Build Agile Applications in AWS Cloud for Government

METRICS @ETSY

Page 90: AWS Webcast - Build Agile Applications in AWS Cloud for Government

METRICS @OBAMA FOR AMERICA

Page 91: AWS Webcast - Build Agile Applications in AWS Cloud for Government

COST-ORIENTED

ARCHITECTURES

Page 92: AWS Webcast - Build Agile Applications in AWS Cloud for Government

PHP+APACHE+VARNISH

NGINX+NODEJS

Page 93: AWS Webcast - Build Agile Applications in AWS Cloud for Government
Page 94: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CONTINUOUS

INTEGRATION

CONTINUOUS

DEPLOYMENT

Page 95: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CONTINUOUS

DEPLOYMENT

=

CONTINUOUS

EXPERIMENTATION

Page 96: AWS Webcast - Build Agile Applications in AWS Cloud for Government

CONTINUOUS

DEPLOYMENT

=

CONTINUOUS

IMPROVEMENT

Page 97: AWS Webcast - Build Agile Applications in AWS Cloud for Government

INNOVATE

Page 98: AWS Webcast - Build Agile Applications in AWS Cloud for Government

« Want to increase innovation?

Lower the cost of failure »

Joi Ito

Page 99: AWS Webcast - Build Agile Applications in AWS Cloud for Government

SPEED AND AGILITY

Experiment

Often

Fail quickly at

a low cost

More

Innovation

Experiment

Infrequently

Failure is

expensive

Less

Innovation

“ON-PREMISE”