You are on page 1of 87

DevOps on AWS: Getting Started

DEPLOYING APPS WITH CODEDEPLOY

Wes Novack
CLOUD ARCHITECT & ENGINEER

@WesleyTech
AWS Continuous Delivery Tools
AWS Continuous Delivery Tools

CodeDeploy
AWS Continuous Delivery Tools

CodeDeploy CodeBuild
AWS Continuous Delivery Tools

CodeDeploy CodeBuild CodePipeline


AWS Continuous Delivery Tools
AWS Continuous Delivery Tools
Code Suite
AWS Continuous Delivery Tools
Code Suite
Developer Tools
AWS Continuous Delivery Tools

CodeDeploy CodeBuild CodePipeline


DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Overview Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
DevOps and Continuous Delivery

Automated deployments
Repeatable and safer
Smaller change sizes
Deploy more frequently
Faster feedback loops
Learn and react quicker
Deliver more value
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
Benefits of CodeDeploy

Automate your deployments


Fully managed serverless service
Free within AWS
$0.02 per on-premises instance update
Centralize control
Versatile
CodeDeploy Components
CodeDeploy Components

Application
The core component
CodeDeploy Components

Application Deployment Group


The core component A target for your
deployment
CodeDeploy Components

Application Deployment Group Deployment


The core component A target for your Roll out an app
deployment revision
A CodeDeploy Application
A CodeDeploy Application

A unique name
An identifier that is unique
inside its AWS account
A CodeDeploy Application

A unique name Compute platform


An identifier that is unique EC2/On-premises, AWS
inside its AWS account Lambda, Amazon ECS
Deployment Groups
Deployment Groups

EC2/On-premises
Autoscaling groups
EC2 instance tags
On-premises hosts
Deployment Groups

EC2/On-premises
Autoscaling groups Lambda
EC2 instance tags
Lambda function name
On-premises hosts
Deployment Groups

EC2/On-premises ECS
An ECS cluster +
Autoscaling groups Lambda An ECS service +
EC2 instance tags
Lambda function name A load balancer +
On-premises hosts
Target Group 1 +
Target Group 2
A CodeDeploy Deployment
A CodeDeploy Deployment

Deployment
group
Targets for the
deployment
A CodeDeploy Deployment

Deployment Deployment
group type
Targets for the “In Place” or
deployment “Blue-Green”
A CodeDeploy Deployment

Deployment Deployment Deployment


group type configuration
Targets for the “In Place” or Such as
deployment “Blue-Green” “One At A Time”
A CodeDeploy Deployment

Deployment Deployment Deployment Revision


group type configuration
Targets for the “In Place” or Such as An application
deployment “Blue-Green” “One At A Time” version
Revisions
Revisions

EC2/On-premises
GitHub commit ID
or
Zip file in S3
Revisions

EC2/On-premises Lambda
GitHub commit ID AppSpec file
or Function name
Zip file in S3 Function alias
Version info
Revisions

EC2/On-premises Lambda ECS


GitHub commit ID AppSpec file AppSpec file
or Function name Task Definition version
Zip file in S3 Function alias Container name
Version info Container port
AppSpec File: appspec.yml
AppSpec File: appspec.yml

version: 0.0
os: linux
files:
- source: /src
destination: /var/www/html
AppSpec File: appspec.yml

version: 0.0
os: linux
files:
- source: /src
destination: /var/www/html
hooks:
BeforeInstall:
- location: scripts/before_install.sh
timeout: 300
runas: root
Installing the CodeDeploy Agent
EC2 or on-premises instance
Installing the CodeDeploy Agent
EC2 or on-premises instance

codedeploy-agent
Installing the CodeDeploy Agent
EC2 or on-premises instance

codedeploy-agent EC2 User Data


Install CodeDeploy - Red Hat
Install CodeDeploy - Red Hat

#!/bin/bash -xe
Install CodeDeploy - Red Hat

#!/bin/bash -xe
yum install -y ruby
Install CodeDeploy - Red Hat

#!/bin/bash -xe
yum install -y ruby

cd /opt
curl -O https://aws-codedeploy-us-east-
1.s3.amazonaws.com/latest/install
Install CodeDeploy - Red Hat

#!/bin/bash -xe
yum install -y ruby

cd /opt
curl -O https://aws-codedeploy-us-east-
1.s3.amazonaws.com/latest/install

chmod +x ./install
./install auto
Demo Create an IAM role with s3 access
Install the codedeploy-agent
Ensure the service is running
Check the CodeDeploy log
Demo Create an IAM role with s3 access
Install the codedeploy-agent
Ensure the service is running
Check the CodeDeploy log
Demo Create an IAM role with s3 access
Install the codedeploy-agent
Ensure the service is running
Check the CodeDeploy log
Demo Create an IAM role with s3 access
Install the codedeploy-agent
Ensure the service is running
Check the CodeDeploy log
Connecting All the Pieces
Connecting All the Pieces
CodeDeploy
Connecting All the Pieces
CodeDeploy

IAM
Connecting All the Pieces
CodeDeploy EC2

IAM
Connecting All the Pieces
CodeDeploy EC2

agent
IAM
Connecting All the Pieces
CodeDeploy EC2

agent IAM
IAM
Connecting All the Pieces
CodeDeploy EC2 GitHub or S3

agent IAM
IAM
Connecting All the Pieces
CodeDeploy EC2 GitHub or S3

agent IAM
Revisions
IAM
Connecting All the Pieces
CodeDeploy EC2 GitHub or S3

agent IAM
Revisions
IAM

ELB
Demo CodeDeploy service role

Create an application
Set up a deployment group
Run a deployment
Demo CodeDeploy service role
Create an application

Set up a deployment group


Run a deployment
Demo CodeDeploy service role
Create an application
Set up a deployment group

Run a deployment
Demo CodeDeploy service role
Create an application
Set up a deployment group
Run a deployment
Demo CodeDeploy service role
Create an application
Set up a deployment group
Run a deployment
Tour the CodeDeploy console
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos
DevOps & Continuous Delivery

Summary Benefits of CodeDeploy


Components of CodeDeploy
The AppSpec file
The codedeploy-agent
Connecting it all together
CodeDeploy console demos

You might also like