SlideShare a Scribd company logo
AWS CodeDeploy
By
Ratan Das
Agenda
✓ What is AWS CodeDeploy?
✓ Benefits
✓ Deployment Types
✓ Overview of In-Place Deployment
✓ Overview of Blue/Green Deployment
✓ Benefit of Blue/Green with AWS
✓ Getting Start with Codedeploy
✓
AWS CodeDeploy
is a deployment
service that
automates
application
deployments to
Amazon EC2
instances, on-
premises
instances, or
serverless
Lambda
functions.
Common Deployment Risks
Challenges
Application Failure
Infrastructure Failure
Capacity Failure
Scaling Issue
People Failure
Process Failure
Rollback Failure
Business Impacts
Downtime
Data Loss
Bad customer experience
Lost Revenue
Burned out stuff
Waste time/ resources
Code Deploy Benefits
‣Server and serverless applications.
‣Automated deployments.
‣Minimize downtime.
‣Stop and roll back.
‣Centralized control.
‣Easy to adopt.
AWS CodeDeploy Deployment Types
A. In-place deployment:
The application on each
instance in the deployment
group is stopped, the latest
application revision is
installed, and the new
version of the application is
started and validated.
Only deployments that use
the EC2/On-Premises
compute platform can use
in-place deployments
B. Blue/Green
Deployment:
A blue/green deployment, in
which traffic is rerouted from
one set of instances (the
original environment) to a
different set (the replacement
environment).
C o d e D e p l o y e n a b l e s
automation of the deployment
workflow. It is a part of the new
a p p l i c a t i o n l i f e c y c l e
management (ALM) tools
provided by AWS that include
C o d e P i p e l i n e a n d
CodeCommit. It also enables
easy roll out of deployments
across a fleet of AWS resources.
Benefits of Blue/Green Deployment
✓An application can be installed and tested on the new instances ahead of time and deployed
to production simply by switching traffic to the new servers.

✓Switching back to the most recent version of an application is faster and more reliable
because traffic can be routed back to the original instances as long as they have not been
terminated. With an in-place deployment, versions must be rolled back by redeploying the
previous version of the application.

✓If you're using the AWS Lambda compute platform, you control how traffic is shifted from
your original AWS Lambda function versions to your new AWS Lambda function versions.
Getting Started with CodeDeploy
1.Create AWS IAM roles 

2.Create AWS instance 

3.Install code deploy 

4.Prepare the application 

5.Configure CodeDeploy on AWS Console 

1. Create AWS IAM roles
The first step towards setting up codedeploy is to setup two IAM roles. One for codedeploy to talk to EC2 instances and other for EC2
instance to
access s3.
• Go to IAM -> roles -> create new Role 

• Give a name for the role “code-deploy” and Goto Next Step 

• In Role Type -> select -> Amazon EC2 below AWS service Roles 

• In Attach Policy select -> AWSCodeDeployRole 

• Create Role 

• Edit the Trust relationship and update the content to the following one
Policy :
{

"Version": "2012-10-17", "Statement": [
{

"Sid": "", "Effect": "Allow", "Principal": {
"Service": "codedeploy.amazonaws.com" },
"Action": "sts:AssumeRole" }
] }
EC2 Instance Profile Role Creation
The second role to give EC2 instance to
access s3.
•Go to IAM -> roles -> create new Role

•Give a name for the role “CodeDeploy-
EC2” and Goto Next Step •In Role Type ->
select -> Amazon EC2 below AWS service
Roles •In Attach Policy select ->
AmazonS3ReadOnlyAccess

•Create Role
2. Create AWS instance
Next step is to Goto EC2 Instances and launch a new instance. While creating an instance
you can choose any instance type but make sure to choose CodeDeploy- EC2 as IAM role
in Configure instance.
In Add tags section add a tag with Name as key and Value as codedeploy- demo (You can
name the instance as per your need)
3. Install code deploy
Once the instance is booted up we can install the code deploy agent that instance
For AWS linux instance:
#!/bin/bash
yum -y update
yum install -y ruby
cd /home/ec2-user
curl -O https://bucket-name.s3.amazonaws.com/latest/install
chmod +x ./install
./install auto
4. Prepare the application
Next is to add the appspec.yml file to the application,
appspec.yml file will have information on what to
install on to instances and what lifecycle events to
run.
AppSpec Sections:
Version – AWS / CodeDeploy specific.

OS – Target operating system

Files – Source / Destination mappings
Permissions – File ownership and permissions
Hooks – Entry points for executing scripts
Appsec file format
Version 0.0
os: linux
files:

- source: /index.html

- destination: /var/www/html/
hooks:
BeforeInstall:
• - location: deploy/before_install 

timeout: 300 runas: root 

AfterInstall: 

• - location: deploy/restart_server 

timeout: 300 runas: root 

•
Version : This section specifies the version of the AppSpec file.
Do not change this value. It is required. Currently the only
allowed value is 0.0. It is reserved by AWS CodeDeploy for
future use.
OS : This section specifies the operating system value of the
instance to which you will deploy. e.g Linux, Windows etc
Files: This section specifies the names of files that should be
copied to the instance during the deployment's Install event.
Permissions :This section specifies how special permissions, if
any, should be applied to the files in the files section as they are
being copied over to the instance.
Hooks: This section specifies scripts to run at specific
deployment lifecycle events during the deployment.
Deployement Hooks Order
Validating AppSpec files
We can use Any online YML parser
http://yaml-online-parser.appspot.com/
Deployment Config-Chose Speed
Blue/Green
Codedeploy
Approach Example
AWS Blue/Green Approaches
• Single EC2 instance with Elastic IP

• Multiple EC2 instance behind an ELB

• DNS redirection using Route53

• Environment swap with Elastic Beanstalk
Blue-Green Deployment Best Practices for Seamless Switching
•Choose Load Balancing Over DNS Switching
•Execute a Rolling Update
•Monitor Your Environments With the Correct Alerts
•Automate, Automate, Automate
•Make Your Code Backward and Forward Compatible
CodeDeploy Intregration to Create a full
CI/CD pipeline
????
Thank You All:-)
23

More Related Content

PPTX
Code Deploy
PPTX
Integrate AWS CodeDeploy With Git And Deploy A Revision
PDF
[Jun AWS 201] Elastic Beanstalk for Startups
PDF
AWS Services - Part 1
PPTX
Aws meetup building_lambda
PPT
Version Control ThinkVitamin
PPTX
Aws meetup ssm
PPTX
Understand AWS OpsWorks - A DevOps Tool from AWS
Code Deploy
Integrate AWS CodeDeploy With Git And Deploy A Revision
[Jun AWS 201] Elastic Beanstalk for Startups
AWS Services - Part 1
Aws meetup building_lambda
Version Control ThinkVitamin
Aws meetup ssm
Understand AWS OpsWorks - A DevOps Tool from AWS

What's hot (8)

PDF
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
PDF
Amazon Elastic Beanstalk
PDF
AWS Code{Commit,Deploy,Pipeline} (June 2016)
PPTX
Continuous Delivery with Elastic Beanstalk And CodePipeline on AWS
PDF
Aws cli
PDF
McrUmbMeetup 22 May 14: Umbraco and Amazon
PDF
Auto scaling applications in 10 minutes (CakeFest 2013)
PDF
AWS CodeCommit, CodeDeploy & CodePipeline
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Amazon Elastic Beanstalk
AWS Code{Commit,Deploy,Pipeline} (June 2016)
Continuous Delivery with Elastic Beanstalk And CodePipeline on AWS
Aws cli
McrUmbMeetup 22 May 14: Umbraco and Amazon
Auto scaling applications in 10 minutes (CakeFest 2013)
AWS CodeCommit, CodeDeploy & CodePipeline
Ad

Similar to AWS CodeDeploy (20)

PPTX
AWS CodeDeploy
PPTX
ACDKOCHI19 - CI / CD using AWS Developer Tools
PDF
CI/CD using AWS developer tools
PDF
Is the order code deploy?
PPTX
AWS CodeDeploy - basic intro
PDF
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
PDF
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
PPTX
AWS Code-Deploy
PDF
Chris Omland - AWS Code Deploy - BSDC 2016
PDF
Knolx - AWS Code Deploy.pdf
PDF
CI&CD on AWS - Meetup Roma Oct 2016
PDF
Community day _aws_ci_cd_v0.2
PDF
A Pathway to Continuous Integration/Continuous Delivery on AWS
PPTX
AWS Atlanta meetup Build Tools - Code Commit, Code Build, Code Deploy
PDF
Transformational DevOps with AWS Native Tools
PPTX
Build and deployment with Jenkins and Code Deploy on AWS
PPTX
DevOps On AWS - Deep Dive on Continuous Delivery
PDF
Aws Deployment Tools - Overview, Details, Implementation
PPTX
CI/CD on AWS
PDF
CI CD using AWS Developer Tools Online Workshop
AWS CodeDeploy
ACDKOCHI19 - CI / CD using AWS Developer Tools
CI/CD using AWS developer tools
Is the order code deploy?
AWS CodeDeploy - basic intro
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
AWS Code-Deploy
Chris Omland - AWS Code Deploy - BSDC 2016
Knolx - AWS Code Deploy.pdf
CI&CD on AWS - Meetup Roma Oct 2016
Community day _aws_ci_cd_v0.2
A Pathway to Continuous Integration/Continuous Delivery on AWS
AWS Atlanta meetup Build Tools - Code Commit, Code Build, Code Deploy
Transformational DevOps with AWS Native Tools
Build and deployment with Jenkins and Code Deploy on AWS
DevOps On AWS - Deep Dive on Continuous Delivery
Aws Deployment Tools - Overview, Details, Implementation
CI/CD on AWS
CI CD using AWS Developer Tools Online Workshop
Ad

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
sap open course for s4hana steps from ECC to s4
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Diabetes mellitus diagnosis method based random forest with bat algorithm
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Mobile App Security Testing_ A Comprehensive Guide.pdf
Programs and apps: productivity, graphics, security and other tools
MYSQL Presentation for SQL database connectivity
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
Big Data Technologies - Introduction.pptx
sap open course for s4hana steps from ECC to s4

AWS CodeDeploy

  • 2. Agenda ✓ What is AWS CodeDeploy? ✓ Benefits ✓ Deployment Types ✓ Overview of In-Place Deployment ✓ Overview of Blue/Green Deployment ✓ Benefit of Blue/Green with AWS ✓ Getting Start with Codedeploy ✓
  • 3. AWS CodeDeploy is a deployment service that automates application deployments to Amazon EC2 instances, on- premises instances, or serverless Lambda functions.
  • 4. Common Deployment Risks Challenges Application Failure Infrastructure Failure Capacity Failure Scaling Issue People Failure Process Failure Rollback Failure Business Impacts Downtime Data Loss Bad customer experience Lost Revenue Burned out stuff Waste time/ resources
  • 5. Code Deploy Benefits ‣Server and serverless applications. ‣Automated deployments. ‣Minimize downtime. ‣Stop and roll back. ‣Centralized control. ‣Easy to adopt.
  • 6. AWS CodeDeploy Deployment Types A. In-place deployment: The application on each instance in the deployment group is stopped, the latest application revision is installed, and the new version of the application is started and validated. Only deployments that use the EC2/On-Premises compute platform can use in-place deployments
  • 7. B. Blue/Green Deployment: A blue/green deployment, in which traffic is rerouted from one set of instances (the original environment) to a different set (the replacement environment). C o d e D e p l o y e n a b l e s automation of the deployment workflow. It is a part of the new a p p l i c a t i o n l i f e c y c l e management (ALM) tools provided by AWS that include C o d e P i p e l i n e a n d CodeCommit. It also enables easy roll out of deployments across a fleet of AWS resources.
  • 8. Benefits of Blue/Green Deployment ✓An application can be installed and tested on the new instances ahead of time and deployed to production simply by switching traffic to the new servers.
 ✓Switching back to the most recent version of an application is faster and more reliable because traffic can be routed back to the original instances as long as they have not been terminated. With an in-place deployment, versions must be rolled back by redeploying the previous version of the application.
 ✓If you're using the AWS Lambda compute platform, you control how traffic is shifted from your original AWS Lambda function versions to your new AWS Lambda function versions.
  • 9. Getting Started with CodeDeploy 1.Create AWS IAM roles 
 2.Create AWS instance 
 3.Install code deploy 
 4.Prepare the application 
 5.Configure CodeDeploy on AWS Console 

  • 10. 1. Create AWS IAM roles The first step towards setting up codedeploy is to setup two IAM roles. One for codedeploy to talk to EC2 instances and other for EC2 instance to access s3. • Go to IAM -> roles -> create new Role 
 • Give a name for the role “code-deploy” and Goto Next Step 
 • In Role Type -> select -> Amazon EC2 below AWS service Roles 
 • In Attach Policy select -> AWSCodeDeployRole 
 • Create Role 
 • Edit the Trust relationship and update the content to the following one Policy : {
 "Version": "2012-10-17", "Statement": [ {
 "Sid": "", "Effect": "Allow", "Principal": { "Service": "codedeploy.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
  • 11. EC2 Instance Profile Role Creation The second role to give EC2 instance to access s3. •Go to IAM -> roles -> create new Role
 •Give a name for the role “CodeDeploy- EC2” and Goto Next Step •In Role Type -> select -> Amazon EC2 below AWS service Roles •In Attach Policy select -> AmazonS3ReadOnlyAccess
 •Create Role
  • 12. 2. Create AWS instance Next step is to Goto EC2 Instances and launch a new instance. While creating an instance you can choose any instance type but make sure to choose CodeDeploy- EC2 as IAM role in Configure instance. In Add tags section add a tag with Name as key and Value as codedeploy- demo (You can name the instance as per your need) 3. Install code deploy Once the instance is booted up we can install the code deploy agent that instance For AWS linux instance: #!/bin/bash yum -y update yum install -y ruby cd /home/ec2-user curl -O https://bucket-name.s3.amazonaws.com/latest/install chmod +x ./install ./install auto
  • 13. 4. Prepare the application Next is to add the appspec.yml file to the application, appspec.yml file will have information on what to install on to instances and what lifecycle events to run. AppSpec Sections: Version – AWS / CodeDeploy specific.
 OS – Target operating system
 Files – Source / Destination mappings Permissions – File ownership and permissions Hooks – Entry points for executing scripts
  • 14. Appsec file format Version 0.0 os: linux files:
 - source: /index.html
 - destination: /var/www/html/ hooks: BeforeInstall: • - location: deploy/before_install 
 timeout: 300 runas: root 
 AfterInstall: 
 • - location: deploy/restart_server 
 timeout: 300 runas: root 
 • Version : This section specifies the version of the AppSpec file. Do not change this value. It is required. Currently the only allowed value is 0.0. It is reserved by AWS CodeDeploy for future use. OS : This section specifies the operating system value of the instance to which you will deploy. e.g Linux, Windows etc Files: This section specifies the names of files that should be copied to the instance during the deployment's Install event. Permissions :This section specifies how special permissions, if any, should be applied to the files in the files section as they are being copied over to the instance. Hooks: This section specifies scripts to run at specific deployment lifecycle events during the deployment.
  • 16. Validating AppSpec files We can use Any online YML parser http://yaml-online-parser.appspot.com/
  • 19. AWS Blue/Green Approaches • Single EC2 instance with Elastic IP • Multiple EC2 instance behind an ELB • DNS redirection using Route53 • Environment swap with Elastic Beanstalk
  • 20. Blue-Green Deployment Best Practices for Seamless Switching •Choose Load Balancing Over DNS Switching •Execute a Rolling Update •Monitor Your Environments With the Correct Alerts •Automate, Automate, Automate •Make Your Code Backward and Forward Compatible
  • 21. CodeDeploy Intregration to Create a full CI/CD pipeline
  • 23. 23