93
CONTINUOUS INTEGRATION AND DEPLOYMENT BEST PRACTICES ON AWS Danilo Poccia Solutions Architect

Continuous Integration and Deployment Best Practices on AWS

Embed Size (px)

DESCRIPTION

Continuous Integration and Deployment Best Practices on AWS

Citation preview

Page 1: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS INTEGRATION AND DEPLOYMENT BEST PRACTICES ON AWS

Danilo Poccia – Solutions Architect

Page 2: Continuous Integration and Deployment Best Practices on AWS

Compute & Networking

Storage & Content Delivery

AWS Global Infrastucture

Database

App Services

Anal

ytic

s

Deployment & Management

API

API

API

Page 3: Continuous Integration and Deployment Best Practices on AWS

API

API

API

Regions Availability Zones Edge Locations

EC2 VPC Route 53 Direct Connect

S3 Glacier CloudFront Storage Gateway

RDS DynamoDB ElastiCache Redshift

SQS SNS SWF SES AppStream CloudSearch Elastic Transcoder

IAM CloudTrail CloudWatch CloudFormation Elastic Beanstalk OpsWorks

EMR

Dat

a Pi

pelin

eK

ines

is

WorkSpaces

Page 4: Continuous Integration and Deployment Best Practices on AWS

Regions Availability Zones Edge Locations

S3 Glacier CloudFront Storage Gateway

RDS DynamoDB ElastiCache Redshift

SQS SNS SWF SES AppStream CloudSearch Elastic Transcoder

IAM CloudTrail CloudWatch CloudFormation Elastic Beanstalk OpsWorks

EMR

Dat

a Pi

pelin

eK

ines

is

EC2 VPC Route 53 Direct Connect WorkSpaces

Page 5: Continuous Integration and Deployment Best Practices on AWS

Regions

Availability ZonesEdge Locations

EC2

VPC Route 53 Direct Connect

S3Glacier

CloudFront

Storage Gateway

RDSDynamoDB

ElastiCache

RedshiftSQS

SNS

SWF

SES

AppStreamCloudSearch

Elastic Transcoder

IAM

CloudTrail

CloudWatch CloudFormation

Elastic

Beanstalk

OpsWorks

EMR

Data Pipeline

Kinesis

WorkSpaces

Page 6: Continuous Integration and Deployment Best Practices on AWS

http://commons.wikimedia.org/wiki/File:Lego_bricks.jpg

Page 7: Continuous Integration and Deployment Best Practices on AWS

BUILDING BLOCKS TO IMPLEMENT YOUR IDEA

Page 8: Continuous Integration and Deployment Best Practices on AWS
Page 9: Continuous Integration and Deployment Best Practices on AWS

FILE SYNC

Page 10: Continuous Integration and Deployment Best Practices on AWS

DATA ANALYSIS

Page 11: Continuous Integration and Deployment Best Practices on AWS

DATA ANALYSIS COSTS < VALUE

Page 12: Continuous Integration and Deployment Best Practices on AWS

AMAZON EC2 SPOT INSTANCES

Page 13: Continuous Integration and Deployment Best Practices on AWS
Page 14: Continuous Integration and Deployment Best Practices on AWS

2013  

280

2011  

82

2010  

612009  

48

2008  

24

2007  

9 Amazon  FPS  Red  Hat  EC2

SimpleDB  CloudFront  EBS  Availability  Zones  Elastic  IPs

Relational  Database  Service  Virtual  Private  Cloud  Elastic  Map  Reduce  

Auto  Scaling  Reserved  Instances  

Elastic  Load  BalancerSimple  Notification  Service  

Route  53  RDS  Multi-­‐AZ  

Singapore  Region  Identity  Access  Management  

Cluster  Instances

Elastic  Beanstalk  Simple  Email  Service  CloudFormation  RDS  for  Oracle  ElastiCache

Redshift  Kinesis  

WorkSpaces  Route  53  Health  Check  

OpsWorks  CloudTrail

number  of  released  features,  sample  services  described

2012  

159Glacier  

DynamoDB  Simple  Workflow  

CloudSearch  Storage  Gateway  

Route  53  Latency  Based  Routing

Page 15: Continuous Integration and Deployment Best Practices on AWS

NEW SERVICES + NEW FEATURES = NEW IDEAS

Page 16: Continuous Integration and Deployment Best Practices on AWS

AMAZON KINESIS REAL-TIME PROCESSING

OF STREAMING DATA AT MASSIVE SCALE

Page 17: Continuous Integration and Deployment Best Practices on AWS

!Data!Sources!

App.4%!

[Machine!Learning]!

!!!!!!!!!!!!!!!

! ! !AW

S!En

dpoint!

App.1%%

[Aggregate!&!De:Duplicate]!

!Data!Sources!

Data!Sources!

!Data!Sources!

App.2%%

[Metric!Extrac=on]!

S3

DynamoDB

Redshift

App.3%[Sliding!Window!Analysis]!

!Data!Sources!

Availability Zone

Shard 1

Shard 2 Shard N

Availability Zone

Availability Zone

Page 18: Continuous Integration and Deployment Best Practices on AWS

CLICKSTREAM ANALYTICS INTERNET OF THINGS METERING & BILLING EVENT PROCESSING SOCIAL NETWORKS LOG COLLECTION …

Page 19: Continuous Integration and Deployment Best Practices on AWS

AMAZON SQS + AUTO SCALING + SPOT INSTANCES !

= FREEMIUM

Page 20: Continuous Integration and Deployment Best Practices on AWS

AMAZON SNS MOBILE PUSH

NOTIFICATIONS

Page 21: Continuous Integration and Deployment Best Practices on AWS
Page 22: Continuous Integration and Deployment Best Practices on AWS

EVE

Online

Page 23: Continuous Integration and Deployment Best Practices on AWS

ANY NEW

IDEA TO BUILD?

Page 24: Continuous Integration and Deployment Best Practices on AWS

THE JOURNEY OF CODE TO

PRODUCTION

Page 25: Continuous Integration and Deployment Best Practices on AWS

WRITTEN TESTED

CONSUMED DEPLOYED

Page 26: Continuous Integration and Deployment Best Practices on AWS

~ MANUFACTURING ~

Page 27: Continuous Integration and Deployment Best Practices on AWS

LEAN MANUFACTURING

Transport Inventory Motion Waiting

Over Production

Over Processing Defects Talent!

& Skills

Page 28: Continuous Integration and Deployment Best Practices on AWS

INFORMATION TECHNOLOGY

Transport Inventory Motion Waiting

Over Production

Over Processing Defects Talent!

& Skills

Page 29: Continuous Integration and Deployment Best Practices on AWS

OPTIMIZE WITH AWS

Transport Inventory Motion Waiting

Over Production

Over Processing Defects Talent!

& Skills

Page 30: Continuous Integration and Deployment Best Practices on AWS

OPTIMIZE WITH AWS

OPPORTUNITY STRATEGY

USE ADJUST

Page 31: Continuous Integration and Deployment Best Practices on AWS

= PROGRAMMABLE

PLATFORM

Page 32: Continuous Integration and Deployment Best Practices on AWS

!

IF YOU CAN DO ITYOU CAN AUTOMATE IT

Page 33: Continuous Integration and Deployment Best Practices on AWS

“Improving daily work is even more important than doing daily work.”

!

!

Gene Kim, Kevin Behr, George Spafford, The Phoenix Project: A Novel About IT, DevOps,

and Helping Your Business Win

Page 34: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS INTEGRATION

Page 35: Continuous Integration and Deployment Best Practices on AWS

DEVELOPER

Page 36: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

Page 37: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

Page 38: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

Page 39: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

PICK TASKS

Page 40: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

SUBMITCODE

Page 41: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

SCHEDULEBUILD

Page 42: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

AUTOMATIC BUILDS

Page 43: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

CODEFETCH

Page 44: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

CODE QUALITY TESTS

TESTRESULTS

Page 45: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

BUILD OUTPUT

Page 46: Continuous Integration and Deployment Best Practices on AWS

SOURCE CODE REPOSITORY

PROJECT MANAGEMENT SERVER

CONTINUOUS INTEGRATION SERVER

DOCS

BINARIES& PACKAGES

Page 47: Continuous Integration and Deployment Best Practices on AWS

TDD TEST-DRIVEN

DEVELOPMENT

Page 48: Continuous Integration and Deployment Best Practices on AWS

BDD BEHAVIOR-DRIVEN

DEVELOPMENT

Page 49: Continuous Integration and Deployment Best Practices on AWS

PAIN POINTS • UNIT TESTS INCOMPLETE • MOCK TESTS MAINTENANCE • EXPENSIVE TEST ENVIRONMENT • TEST ENVIRONMENT ≠ PRODUCTION • DEPLOYMENT CYCLES

Page 50: Continuous Integration and Deployment Best Practices on AWS

“Complexity arises when the dependencies among the elements

become important.” !

!

Scott E. Page, John H. Miller,Complex Adaptive Systems:

An Introduction to Computational Models of Social Life

Page 51: Continuous Integration and Deployment Best Practices on AWS

REAL USERS =

REAL FEEDBACK

Page 52: Continuous Integration and Deployment Best Practices on AWS

CLOSE THE FEEDBACK

LOOP AS QUICKLY

AS POSSIBLE

Page 53: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS INTEGRATION

CONTINUOUS DEPLOYMENT

Page 54: Continuous Integration and Deployment Best Practices on AWS

SOFTWARE DEPLOY

≠PRODUCT LAUNCH

Page 55: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS DEPLOYMENT

SMALL, FREQUENT CHANGES CONSTANTLY INTEGRATING INTO

PRODUCTION

Page 56: Continuous Integration and Deployment Best Practices on AWS

KEY = ITERATION

Page 57: Continuous Integration and Deployment Best Practices on AWS

ITERATION =

MODIFY THE SYSTEM TO BETTER MEET THE EXPECTATIONS OF

YOUR USERS

Page 58: Continuous Integration and Deployment Best Practices on AWS

FEATURE SWITCH FEATURE FLIPPER FEATURE TOGGLE

FEATURE FLAG CONDITIONAL FEATURE

Page 59: Continuous Integration and Deployment Best Practices on AWS

// To totally enabled a feature !$server_config[‘foo'] = ‘on’;!!

// To totally disabled a feature!$server_config['foo'] = ‘off’;!!

// Feature with variant turned on for everyone!$server_config['foo'] = 'blue_background';!!

// Enabled for 10% of regular users and all admins!$server_config[‘foo'] = array(!   'enabled' => 10,!   'admin' => 'on',!!);

https://github.com/etsy/feature

Page 60: Continuous Integration and Deployment Best Practices on AWS

!if (Feature::isEnabled('my_feature')) {!!    // do stuff!!}!! !!if (Feature::isEnabled('my_feature')) {!! !!    switch (Feature::variant('my_feature')) {!!      case 'foo':!!          // do stuff appropriate for the foo variant!!          break;!!      case 'bar':!!          // do stuff appropriate for the bar variant!!          break;!!    }!!}

https://github.com/etsy/feature

Page 61: Continuous Integration and Deployment Best Practices on AWS

A / B TESTING CONTENT

Page 62: Continuous Integration and Deployment Best Practices on AWS

// Single-variant feature in 50/50 A/B test!!

$server_config['foo'] = array('enabled' => 50);!!

// Multi-variant feature in A/B test!// with 20% of users seeing each variant!// (and 40% left in control group)!!

$server_config['foo'] = array(!!   'enabled' => array(!!       'blue_background'   => 20,!!       'orange_background' => 20,!!       'pink_background'   => 20,!!   ),!!);

https://github.com/etsy/feature

Page 63: Continuous Integration and Deployment Best Practices on AWS
Page 64: Continuous Integration and Deployment Best Practices on AWS

AWS OPSWORKS MODEL AND MANAGE

THE ENTIRE APPLICATION

Page 65: Continuous Integration and Deployment Best Practices on AWS
Page 66: Continuous Integration and Deployment Best Practices on AWS

14 BILLION REQUESTS/MONTH50 000 DATABASE UPDATES / SEC

NO CACHE

CASE STUDY

Page 67: Continuous Integration and Deployment Best Practices on AWS
Page 68: Continuous Integration and Deployment Best Practices on AWS
Page 69: Continuous Integration and Deployment Best Practices on AWS
Page 70: Continuous Integration and Deployment Best Practices on AWS
Page 71: Continuous Integration and Deployment Best Practices on AWS

A / B TESTING NOT JUST FOR CONTENT

Page 72: Continuous Integration and Deployment Best Practices on AWS

USER INTERFACE ALGORITHMS

ARCHITECTURES COST OPTIMIZATION

Page 73: Continuous Integration and Deployment Best Practices on AWS

AWS CLOUDFORMATION INFRASTRUCTURE IS CODE

Page 74: Continuous Integration and Deployment Best Practices on AWS

CLOUDFORMATION TEMPLATE

Page 75: Continuous Integration and Deployment Best Practices on AWS
Page 76: Continuous Integration and Deployment Best Practices on AWS
Page 77: Continuous Integration and Deployment Best Practices on AWS

APPLICATION VERSIONS

+INFRASTRUCTURE

VERSIONS

Page 78: Continuous Integration and Deployment Best Practices on AWS

CLOUDFORMATION TEMPLATE

Page 79: Continuous Integration and Deployment Best Practices on AWS

AWS ELASTIC BEANSTALK

QUICKLY DEPLOY AND MANAGE APPLICATIONS

Page 80: Continuous Integration and Deployment Best Practices on AWS
Page 81: Continuous Integration and Deployment Best Practices on AWS
Page 82: Continuous Integration and Deployment Best Practices on AWS

Production Environment

Test Environment

master branch

test branch

Git Repository

git commit

git aws.push

git aws.push

Swap URLs

Page 83: Continuous Integration and Deployment Best Practices on AWS

AMAZON EC2 API / SDK / CLI

Page 84: Continuous Integration and Deployment Best Practices on AWS
Page 85: Continuous Integration and Deployment Best Practices on AWS

for ip in $(!!

aws ec2 describe-instances! --filter Name=instance-state-name,Values=running,! Name=tag:aws:autoscaling:groupName,Values=XXX! --query Reservations[].Instances[].PublicDnsName! --output text!!

); do ssh -t ec2-user@$ip "/app/update.sh"; done!!

Page 86: Continuous Integration and Deployment Best Practices on AWS

ALL TOGETHER NOW! !

!

!

!

!

Page 87: Continuous Integration and Deployment Best Practices on AWS

DEPLOYMENTS AT AMAZON.COM

!

!

!

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

Page 88: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS DEPLOYMENT

= CONTINUOUS

EXPERIMENTATION

Page 89: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS DEPLOYMENT

= CONTINUOUS INNOVATION

Page 90: Continuous Integration and Deployment Best Practices on AWS

http://commons.wikimedia.org/wiki/File:Lego_bricks.jpg

Page 91: Continuous Integration and Deployment Best Practices on AWS

« Want to increase innovation? Lower the cost of failure »

!

Joi Ito

Page 92: Continuous Integration and Deployment Best Practices on AWS

CONTINUOUS INTEGRATION AND DEPLOYMENT BEST PRACTICES ON AWS

Danilo Poccia – Solutions Architect

Page 93: Continuous Integration and Deployment Best Practices on AWS