68
NEW YORK ©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

DevOps, Continuous Integration and Deployment on AWS

Embed Size (px)

Citation preview

Page 1: DevOps, Continuous Integration and Deployment on AWS

NEW YORK

©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

Page 2: DevOps, Continuous Integration and Deployment on AWS

©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved

DevOps, Continuous Integration and

Deployment on AWS

Leo Zhadanovsky, Senior Solutions Architect, AWS

@leozh

Ed Zarecor, DevOps Lead, EdX

Page 3: DevOps, Continuous Integration and Deployment on AWS

DevOps

Page 4: DevOps, Continuous Integration and Deployment on AWS

What is DevOps?

• « DevOps is the practice of operations

and development engineers participating

together in the entire service lifecycle,

from design through the development

process to production support »

- theagileadmin.com

Page 5: DevOps, Continuous Integration and Deployment on AWS

Continuous Integration

Page 6: DevOps, Continuous Integration and Deployment on AWS

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

• Helps automate deployments

• Allows rapid development and deployment

Page 7: DevOps, Continuous Integration and Deployment on AWS

SOURCE CODE

REPOSITORY

PROJECT MANAGEMENT

SERVER

CONTINUOUS

INTEGRATION SERVER

DEVELOPER

PICK

TASKS

SUBMIT

CODE

SCHEDULE

BUILD

RECURRENT

BUILDS

CODE

FETCHCODE QUALITY

TESTS

TEST

RESULTS

BUILD OUTPUT

DOCS

BINARIES

& PACKAGES

DEV FACING

NOTIFICATIONS

CLOUDFORMATION

AMIS or CONTAINERS

Page 8: DevOps, Continuous Integration and Deployment on AWS
Page 9: DevOps, Continuous Integration and Deployment on AWS

SOURCE

CODE

REPOSITORY

DNS

CONTINUOUS

INTEGRATION

SERVER

PROJECT

MANAGEMENT

SERVER

BUILDS

Page 10: DevOps, Continuous Integration and Deployment on AWS

AWS code services

AWS CodeCommit

Launched Today

AWS CodePipeline

Launched Today

AWS CodeDeploy

Launched Nov 2014

Page 11: DevOps, Continuous Integration and Deployment on AWS

Cloud software development lifecycle

10/13/14 11

MonitorProvisionDeployTestBuildCode

AWS Elastic Beanstalk

AWS OpsWorks

Amazon

CloudWatch

AWS

CloudFormation

?

Page 12: DevOps, Continuous Integration and Deployment on AWS

Cloud software development lifecycle

10/13/14 12

MonitorProvisionDeployTestBuildCode

AWS Elastic Beanstalk

AWS OpsWorks

CloudWatchCloudFormationCodeDeploy

CodeCommit CodePipeline

Page 13: DevOps, Continuous Integration and Deployment on AWS

CODECOMMIT

DNS

CODEPIPELINE

PROJECT

MANAGEMENT

SERVER

BUILDS

Page 14: DevOps, Continuous Integration and Deployment on AWS

PAIN POINTS• UNIT TESTS INCOMPLETE

• MOCK TESTS MAINTENANCE

• EXPENSIVE TEST ENVIRONMENT

• TEST ENVIRONMENT ≠ PRODUCTION

• DEPLOYMENT CYCLES

Page 15: DevOps, Continuous Integration and Deployment on AWS

ON-DEMAND

PAY AS YOU GO

ELASTIC

Page 16: DevOps, Continuous Integration and Deployment on AWS

=PROGRAMMABLE PLATFORM

Page 17: DevOps, Continuous Integration and Deployment on AWS
Page 18: DevOps, Continuous Integration and Deployment on AWS
Page 19: DevOps, Continuous Integration and Deployment on AWS

IF YOU CAN PROGRAM IT

YOU CAN AUTOMATE IT

Page 20: DevOps, Continuous Integration and Deployment on AWS

A lot of options…

• Configuration Management Systems– Puppet

– Chef

– Saltstack

• Deployment Frameworks– CodeDeploy

– AWS Elastic Beanstalk

– AWS OpsWorks

– Ansible

– Fabric

– Capistrano

• Infrastructure Management– CloudFormation

• Containers– Amazon EC2 Container Service

Page 21: DevOps, Continuous Integration and Deployment on AWS

APPLICATION VERSIONS

+INFRASTRUCTURE

VERSIONS

Page 22: DevOps, Continuous Integration and Deployment on AWS

CLOUDFORMATION

TEMPLATE

Page 23: DevOps, Continuous Integration and Deployment on AWS

CONTINUOUS

DEPLOYMENTSMALL, FREQUENT CHANGES

CONSTANTLY INTEGRATING INTO

PRODUCTION.

Page 24: DevOps, Continuous Integration and Deployment on AWS

KEY = ITERATION

Page 25: DevOps, Continuous Integration and Deployment on AWS

ITERATION

=MODIFY THE SYSTEM TO BETTER

MEET THE EXPECTATIONS OF

YOUR USERS

Page 26: DevOps, Continuous Integration and Deployment on AWS

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

(in 2011)

Page 27: DevOps, Continuous Integration and Deployment on AWS

SOFTWARE DEPLOY

≠PRODUCT LAUNCH

Page 28: DevOps, Continuous Integration and Deployment on AWS

DATA-DRIVEN

ARCHITECTURES

Page 29: DevOps, Continuous Integration and Deployment on AWS

METRICS @ETSY

Page 30: DevOps, Continuous Integration and Deployment on AWS

METRICS @OBAMA FOR AMERICA

Page 31: DevOps, Continuous Integration and Deployment on AWS

Metrics and Monitoring Options

CloudWatch

… and many more

Page 32: DevOps, Continuous Integration and Deployment on AWS

CONTINUOUS

INTEGRATION

CONTINUOUS

DEPLOYMENT

Page 33: DevOps, Continuous Integration and Deployment on AWS

CONTINUOUS DEPLOYMENT

=

CONTINUOUS EXPERIMENTATION

Page 34: DevOps, Continuous Integration and Deployment on AWS

CONTINUOUS DEPLOYMENT

=

CONTINUOUS IMPROVEMENT

Page 35: DevOps, Continuous Integration and Deployment on AWS

INNOVATE

Page 36: DevOps, Continuous Integration and Deployment on AWS

SPEED AND AGILITY

Experiment

Often

Fail quickly

at a low

cost

More

Innovation

Experiment

Infrequently

Failure is

expensive

Less

Innovation

“ON-

PREMISES”

Page 37: DevOps, Continuous Integration and Deployment on AWS

DevOps@edX

A report from the frontline of an evolving and, hopefully, continuously improving DevOps organization,

July, 2015

Page 38: DevOps, Continuous Integration and Deployment on AWS

*

About edX

‣ Created in May, 2012 by Harvard and MIT

‣ More than 4 million students from every country

‣ More than 12 million course enrollments

‣ 65 prestigious member institutions from around the world

Page 39: DevOps, Continuous Integration and Deployment on AWS

*

Our Vision

To democratize and reimagine education by increasing worldwide educational

access and create a culture of continuous, lifelong learning.

Anyone, anywhere with a desire to learn and an Internet connection can take

quality online courses.

Page 40: DevOps, Continuous Integration and Deployment on AWS

*

edX, the Open Source Project

Page 41: DevOps, Continuous Integration and Deployment on AWS

*

edX on AWS

How we use AWS

‣ Deployed on AWS since the beginning

‣ Use many AWS services, but especially

‣ EC2

‣ RDS

‣ S3

‣ Cloudfront

‣ EMR

‣ Everything in the VPC

‣ Tend to be early adopters

‣ AWS Marketplace image in partnership with Bitnami

Page 42: DevOps, Continuous Integration and Deployment on AWS

*

edX on AWS

Why we value AWS

‣ Breadth of offering

‣ Pay-for-what-you-use

‣ “Elastic” everywhere; scales-up and scales-down

‣ A continuum of options from “bare metal” to Elastic Beanstalk

‣ Few tie-ins

‣ Global footprint

Page 43: DevOps, Continuous Integration and Deployment on AWS

*

What the hell have you built?

With apologies to @codinghorror

Page 44: DevOps, Continuous Integration and Deployment on AWS

**

Key DevOps Learnings

‣ Infrastructure As Code

‣ Immutable Infrastructure

Page 45: DevOps, Continuous Integration and Deployment on AWS

**

Infrastructure as Code

Page 46: DevOps, Continuous Integration and Deployment on AWS

**

Why

‣ We need to deploy services quickly and consistently

‣ Relationships between services are complex

‣ Each additional service adds incremental operational complexity

Infrastructure as Code

Page 47: DevOps, Continuous Integration and Deployment on AWS

**

Each service is complex in its own right

Infrastructure as Code

Page 48: DevOps, Continuous Integration and Deployment on AWS

**

How

‣ CloudFormation

‣ Terraform: https://www.terraform.io/

‣ Home-grown solutions

Infrastructure as Code

Page 49: DevOps, Continuous Integration and Deployment on AWS

**

Infrastructure as Code

Cloud Migrator

“A simple, opinionated pattern and tools for discrete, scalable, fault-tolerant

services”

Ed

Page 50: DevOps, Continuous Integration and Deployment on AWS

**

Infrastructure as Code

How we realize the components in AWS

Page 51: DevOps, Continuous Integration and Deployment on AWS

**

Cloud Migrator Design goals:

‣ Ease of adding new services

‣ Minimal additional configuration per service required

‣ Flexible per service configuration supported

‣ Idempotent

‣ D.R.Y.

Infrastructure as Code

Page 52: DevOps, Continuous Integration and Deployment on AWS

**

What Cloud Migrator descriptors look like:

‣ yaml

‣ Minimally specify

‣ tags

‣ ports

‣ service CIDR blocks

‣ Anything can be overridden

‣ Easy to extend

Infrastructure as Code

Page 53: DevOps, Continuous Integration and Deployment on AWS

**

---

cluster: "notes"

play: "{{ cluster }}"

services_tag: "edx_notes_api"

service_port: 18120

instance_type: "m3.medium"

private_subnet_1: "{{ vpc_class_b }}.110.32/28"

private_subnet_2: "{{ vpc_class_b }}.120.32/28"

private_elb_subnet_1: "{{ vpc_class_b }}.110.128/28"

private_elb_subnet_2: "{{ vpc_class_b }}.120.128/28"

Infrastructure as Code

Page 54: DevOps, Continuous Integration and Deployment on AWS

**

Immutable Infrastructure

Page 55: DevOps, Continuous Integration and Deployment on AWS

**

Immutable Infrastructure

Why

‣ Traceability, everything in SCM

‣ Pull request workflow

‣ Strong consistency guarantees with identical, tested artifacts

‣ Dead simple auto-scaling

‣ Clear path to automation

Page 56: DevOps, Continuous Integration and Deployment on AWS

**

Immutable Infrastructure

How

‣ Our deployment artifacts are pre-baked AMIs

‣ Several versions of application software and config converge to produce our

AMIs

‣ Another homegrown tool, Abbey, builds AMIs

‣ Abbey leverages our configuration management tool of choice, Ansible

Page 57: DevOps, Continuous Integration and Deployment on AWS

**

An Aside: Why Ansible

‣ We appreciate its simplicity

‣ It’s built on tried and true tools like SSH

‣ Dynamic inventories using cloud-friendly selectors like tags

‣ It is agentless

‣ We are heavily invested in Python

Page 58: DevOps, Continuous Integration and Deployment on AWS

**

Cutting an Image

Page 59: DevOps, Continuous Integration and Deployment on AWS

**

Cutting an Image

Page 60: DevOps, Continuous Integration and Deployment on AWS

**

Cutting an Image

Need something cut, talk to @alton

Page 61: DevOps, Continuous Integration and Deployment on AWS

**

Chatting with @alton

Page 62: DevOps, Continuous Integration and Deployment on AWS

**

Chatting with @alton

Page 63: DevOps, Continuous Integration and Deployment on AWS

**

Comparing Images

Page 64: DevOps, Continuous Integration and Deployment on AWS

**

Deploying

Page 65: DevOps, Continuous Integration and Deployment on AWS

**

Blue/Green Deploys

Page 66: DevOps, Continuous Integration and Deployment on AWS

**

Whither edX Ops

‣ Continue down the road of decomposing our monolithic application into

independent services

‣ Improve testing, especially automated integration tests

‣ Move to a more fully automated CI/CD pipeline

‣ Expand our geographic reach

‣ Continuously improve our infrastructure

‣ Support our open-source partners

‣ Leverage service discovery

‣ Containers, containers, containers

Page 67: DevOps, Continuous Integration and Deployment on AWS

**

Contact Details

‣ Edward Zarecor, DevOps Lead@edX, [email protected]

‣ edX on github: https://github.com/edx

‣ On github I’m e0d

Page 68: DevOps, Continuous Integration and Deployment on AWS

NEW YORK