chris omland - aws code deploy - bsdc 2016

15
Big Sky Dev Con 2016 AWS CodeDeploy Chris Omland

Upload: roblund

Post on 22-Jan-2018

136 views

Category:

Software


2 download

TRANSCRIPT

Big Sky Dev Con 2016

AWS CodeDeploy Chris Omland

Goal Of This SessionDeploying To Production

Before After

Assumptions❖ Basic understanding of AWS concepts

❖ IAM

❖ EC2

❖ S3

❖ AWS CLI

❖ Autoscaling

❖ ELB

Complexity of Deployment

EC2 Instance EC2 Instance

EC2 Instance

EC2 InstanceEC2 Instance EC2 Instance

EC2 Instance

EC2 Instance

Test

Production

Production +1

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

• Deregister from ELB…• Stop web server…• Update database…• Run some utility scripts…• Copy new application files…• Start web server…• Run validation script…

Application Revision

What Is AWS CodeDeploy?

AWS service to coordinate application deployments

Features of AWS CodeDeploy

❖ Automates code deployments to any instance

❖ Rolling updates so you can minimize downtime

❖ Stop and rollback if there are errors

❖ Track application deployment progress

❖ Platform and language agnostic

Application: What, How and Where

Revision 3

Revision 2

Revision 1

What To Deploy How To Deploy

Deployment Configuration

Where To Deploy

EC2 Instance

EC2 Instance

EC2 Instance

Auto Scaling Group

Deployment Group

Application RevisionRevision

Source content(source code, web pages, executables, etc…)Deployment ScriptsAppSpec file

version - 0.0 os - Linux or Windows

Application files Permissions for files

Scripts that will run for each of the deployment lifecycle events (Validation hook not shown)

http://docs.aws.amazon.com/codedeploy/latest/userguide/app-spec-ref.html

Deployment Configuration

EC2 InstanceTag: Test

EC2 InstanceTag: Test

EC2 InstanceTag: Prod

EC2 InstanceTag: Prod

Auto Scaling Group

EC2 InstanceTag: Prod

EC2 InstanceTag: Prod

Version 1.x

Deployment GroupOne at a time

EC2 InstanceTag: Prod

EC2 InstanceTag: Prod

Version 1.x

Half at a time

Version 1.xVersion 1.x

All at once

Version 1.xVersion 1.xVersion 1.xVersion 1.x

Version 1.xVersion 1.x

Version 1.xVersion 1.x

Deployment LifecycleStartConsole

AWS CLI/SDKAuto Scale

ApplicationStopHook

Download Bundle

GithubS3

Bitbucket

Before Install

Hook

Install

Files from AppSpec

After Install

Hook

Application StartHook

Validate Service

Hook

End

*Not on 1st app deployment

My Pre-Setup

❖ Simple EC2 instance and AMI

❖ Nodejs as a service

❖ Codedeploy Agent

❖ http://docs.aws.amazon.com/codedeploy/latest/userguide/how-to-run-agent.html#how-to-run-agent-install

❖ AWS CLI

IAM Setup❖ User role

❖ User permissions to use codedeploy

❖ “codedeploy:*"

❖ Service Role — Grants permissions to AWS Services

❖ AWSCodeDeployRole

❖ Instance Role — Grants permission to EC2 Instances

❖ Attach to instance BEFORE you launch

DEMO TIME

Things To Know❖ No cost for Codedeploy

❖ Region Support: US East

❖ (N. Virginia) us-east-1

❖ US West (N. California)us-west-1

❖ US West (Oregon) us-west-2

❖ EU/APAC/South America

❖ Log files at /opt/codedeploy-agent/deployment-root/deployment-logs

❖ ApplicationStop failures

❖ Autoscaling failures on version mismatch

❖ Autoscaling instances should install the codedeploy agent on startup

FIN, ACK

❖ Just an introduction, lots more you can do!

❖ Thank you very much!

❖ Please introduce yourself

❖ Questions