Top Banner
Big Sky Dev Con 2016 AWS CodeDeploy Chris Omland
15

Chris Omland - AWS Code Deploy - BSDC 2016

Jan 22, 2018

Download

Software

roblund
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: Chris Omland - AWS Code Deploy - BSDC 2016

Big Sky Dev Con 2016

AWS CodeDeploy Chris Omland

Page 2: Chris Omland - AWS Code Deploy - BSDC 2016

Goal Of This SessionDeploying To Production

Before After

Page 3: Chris Omland - AWS Code Deploy - BSDC 2016

Assumptions❖ Basic understanding of AWS concepts

❖ IAM

❖ EC2

❖ S3

❖ AWS CLI

❖ Autoscaling

❖ ELB

Page 4: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 5: Chris Omland - AWS Code Deploy - BSDC 2016

What Is AWS CodeDeploy?

AWS service to coordinate application deployments

Page 6: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 7: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 8: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 9: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 10: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 11: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 12: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 13: Chris Omland - AWS Code Deploy - BSDC 2016

DEMO TIME

Page 14: Chris Omland - AWS Code Deploy - BSDC 2016

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

Page 15: Chris Omland - AWS Code Deploy - BSDC 2016

FIN, ACK

❖ Just an introduction, lots more you can do!

❖ Thank you very much!

❖ Please introduce yourself

❖ Questions