SlideShare a Scribd company logo
CI & CD ON AWS
Build and deliver products using AWS
Sistemi Distribuiti e Cloud Computing
Università degli Studi di Roma "Tor Vergata”
DICII
Paolo Latella

XPeppers - Cloud & DevOps

paolo.latella@xpeppers.com
@LatellaPaolo
WHAT ARE CI AND CD ?
• Continuous Integration: ?
• Continuous Delivery: ?
paolo.latella@xpeppers.com
WHAT ARE CI AND CD ?
• Continuous Integration: every time
somebody commits any change, the entire
application is built and a comprehensive set of
automated tests is run against it.
• Continuous Delivery: more than just a new
delivery methodology. It is a whole new paradigm
for running a business that depends on software.
Continuous Delivery - Jez Humble, David Farley
CI/CD AWSTOOLS
Code Build Test Provision Deploy Monitor
Integration
Delivery
AWS CodePipeline AWS CodeBuildAWS CodeCommit
AWS CodeDeploy
AWS
CloudFormation
AWS OpsWorks
Amazon EC2
Container Service
AWS Elastic
Beanstalk
Amazon
CloudWatch
AWS

CloudTrail
paolo.latella@xpeppers.com
CODECOMMIT
• Fully managed.
• Repositories of any size and any file type.
• Has highly available repositories.
• Choose the region where your repository should reside.
• Supports the standard functionality of Git
• Online code tools to browse, edit, and collaborate on projects.
paolo.latella@xpeppers.com
CODECOMMIT
Host git-codecommit.*.amazonaws.com
User APKAEIBAERJR2EXAMPLE
IdentityFile ~/.ssh/codecommit_rsa
git clone ssh://git-codecommit.us-
east-1.amazonaws.com/v1/repos/MyDemoRepo
my-demo-repo
$ ssh-keygen
Generate public/private rsa key pair.
paolo.latella@xpeppers.com
CODEPIPELINE
• Graphical user interface to create, configure, and
manage your pipeline Fully managed.
• Parallel Execution
• Integration with CodeDeploy, Lambda, S3,
CodeCommit, Beanstalk, Opsworks and third-party
tools
• Custom action, manual approval, retry,
https://aws.amazon.com/codepipeline/product-integrations/
paolo.latella@xpeppers.com
CODEPIPELINE
Source
Specify where source code is
stored.
Amazon S3, GitHub
Build
Specify how application should
be built.
Jenkins and
other providers
Test
Specify how application should
be tested.
Jenkins, Ghost Inspector
and other providers
Deploy
Specify how application should
be deployed.
AWS Elastic Beanstalk,
AWS CodeDeploy
Invoke
Specify custom function to
invoke.
AWS Lambda
Actions
Pipeline
Parallel actions
paolo.latella@xpeppers.com
CODEBUILD
• Fully managed: eliminates the need to set up, patch, update,
and manage your own build servers.
• On demand: scales on demand to meet your build needs.
You pay only for the number of build minutes you
consume.
• Out of the box: provides preconfigured build environments
for the most popular programming languages.All you need
to do is point to your build script to start your first build.
https://aws.amazon.com/codepipeline/product-integrations/
paolo.latella@xpeppers.com
CODEBUILD
paolo.latella@xpeppers.com
CODEDEPLOY
• Coordinates application deployments to Amazon
EC2 instances.
• Deploy from a GitHub repository or from any local
codebase.
• Manage deployments across environments, upgrade
applications, and perform rolling updates.
• Supports Linux and Windows deployments.
paolo.latella@xpeppers.com
Deployment Group
Auto Scaling Group
Agent Agent
Agent Agent
Tags:Name=DeploymentTarget,

Value=OurAppOnCodeDeploy
Create Deployment
AWS CodeDeploy
Pull Latest Revision
AWS CodeDeploy-ready
deployment
AppSpec fileApplication
+
Revision 1
Revision 2
Revision 3
Amazon S3 Bucket
CODEDEPLOY
paolo.latella@xpeppers.com
CODEDEPLOY
version: 0.0
os: linux
files:
- source: Config/config.txt
destination: /webapps/Config
- source: source
destination: /webapps/myApp
hooks:
BeforeInstall:
- location: Scripts/UnzipResourceBundle.sh
- location: Scripts/UnzipDataBundle.sh
AfterInstall:
- location: Scripts/RunResourceTests.sh
timeout: 180
ApplicationStart:
- location: Scripts/RunFunctionalTests.sh
timeout: 3600
ValidateService:
- location: Scripts/MonitorService.sh
timeout: 3600
runas: codedeployuser
Hooks
CODEDEPLOY
#!/usr/bin/python
import boto3
import urllib2
import time
CONNECTION_DRAINING_TIMEOUT = 60
print "Get metadata for instance"
instance_id=urllib2.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read()
availability_zone=urllib2.urlopen('http://169.254.169.254/latest/meta-data/placement/availability-zone').read()
region = availability_zone[:-1]
asg = boto3.client('autoscaling',region)
print 'Trying to move instance ' + instance_id + ' in stand-by'
res_asg_of_instance = asg.describe_auto_scaling_instances(InstanceIds=[instance_id])
name_asg_of_instance = res_asg_of_instance['AutoScalingInstances'][0]['AutoScalingGroupName']
state_of_instance = res_asg_of_instance['AutoScalingInstances'][0]['LifecycleState']
if (state_of_instance == 'InService'):
res_enter_in_standby =
asg.enter_standby(InstanceIds=[instance_id],AutoScalingGroupName=name_asg_of_instance,ShouldDecrementDesiredCapac
ity=True)
print 'Instance ' + instance_id + 'entering in stand-by'
print res_enter_in_standby
time.sleep(CONNECTION_DRAINING_TIMEOUT)
exit(0)
if (state_of_instance == 'Standby'):
print 'Instance ' + instance_id + ' already in stand-by'
time.sleep(10)
exit(0)
else:
print 'Instance ' + instance_id + ' is in ' + state_of_instance + ' ignoring ...'
exit(0)
Application Stop
?
BLUE/GREEN
DEPLOYMENT
paolo.latella@xpeppers.com
BLUE/GREEN DEPLOYMENT
v1.0 v2.0
INFRASTRUCTURE AS CODE
Infrastructure Automation
Configuration Management
Application Deployment
I
a
C
paolo.latella@xpeppers.com
CLOUDFORMATION
• Simplify infrastructure management in the cloud
• Perform predictable, repeatable, and automated
deployments.
• Easily control and track changes to your infrastructure.
• Simply JSON orYAML formatted text file that describes
the AWS infrastructure
paolo.latella@xpeppers.com
CLOUDFORMATION
CloudFormation
Engine
Template Stack
JSON Syntax
Versioning
Runtime parameters
Dependency
Dependencies
Conflict resolve
All Resources
Create/Update/Delete
Scriptable
Deploy several times
Multiregions
Dev, Test, Prod
paolo.latella@xpeppers.com
Amazon

Route 53
AWS BLUE/GREEN
DEPLOYMENT
Auto Scaling group Auto Scaling group
instances instances
template
BLUE

Stack
AWS

CloudFormation
GREEN

Stack
90% 10%
alarm
IF (alarm) 

Then Rollback
else increment %
AWS 

CodeDeploy
ALLTOGETHER
GRAZIE!
Q&A
Paolo Latella

XPeppers - Agile, Cloud & DevOps

paolo.latella@xpeppers.com
@LatellaPaolo

More Related Content

PPTX
Serverless architectures on aws
PPTX
Amazon Web Services and Docker: from developing to production
PDF
CI&CD on AWS - Meetup Roma Oct 2016
PPTX
AWS CloudFormation template with single & redundant system
PDF
"How to optimize the architecture of your platform" by Julien Simon
PPTX
Aws tutorial for beginners- tibacademy.in
PDF
Aws concepts-power-point-slides
PDF
AWS CloudFormation (February 2016)
Serverless architectures on aws
Amazon Web Services and Docker: from developing to production
CI&CD on AWS - Meetup Roma Oct 2016
AWS CloudFormation template with single & redundant system
"How to optimize the architecture of your platform" by Julien Simon
Aws tutorial for beginners- tibacademy.in
Aws concepts-power-point-slides
AWS CloudFormation (February 2016)

Similar to CI & CD on Amazon Web Services (20)

PPTX
CI/CD on AWS
PPTX
Devops on AWS
PDF
Continuous Deployment with Amazon Web Services
PPTX
CI/CD using CodeCommit CodeBuild CodeDeploy CodePipeline
PDF
Community day _aws_ci_cd_v0.2
PDF
A Pathway to Continuous Integration/Continuous Delivery on AWS
PDF
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
PDF
CI&CD with AWS - AWS Prague User Group - May 2015
PPTX
ACDKOCHI19 - CI / CD using AWS Developer Tools
PDF
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
PPTX
AWS Codepipeline presented by Techserverglobal
PPTX
Development tools
PDF
CI/CD using AWS developer tools
PDF
Aws Deployment Tools - Overview, Details, Implementation
PDF
DevOps Spain 2019. Pedro Mendoza-AWS
PPTX
imagic 2.pptx
PPTX
DevOps and AWS - Code PaLOUsa 2017
PDF
AWS CodeCommit, CodeDeploy & CodePipeline
PPTX
CI/CD with AWS Code Services
PDF
Devops with Amazon Web Services (January 2017)
CI/CD on AWS
Devops on AWS
Continuous Deployment with Amazon Web Services
CI/CD using CodeCommit CodeBuild CodeDeploy CodePipeline
Community day _aws_ci_cd_v0.2
A Pathway to Continuous Integration/Continuous Delivery on AWS
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
CI&CD with AWS - AWS Prague User Group - May 2015
ACDKOCHI19 - CI / CD using AWS Developer Tools
CI CD using AWS Developer Tools @ AWS Community Day Bengaluru 2018
AWS Codepipeline presented by Techserverglobal
Development tools
CI/CD using AWS developer tools
Aws Deployment Tools - Overview, Details, Implementation
DevOps Spain 2019. Pedro Mendoza-AWS
imagic 2.pptx
DevOps and AWS - Code PaLOUsa 2017
AWS CodeCommit, CodeDeploy & CodePipeline
CI/CD with AWS Code Services
Devops with Amazon Web Services (January 2017)
Ad

More from Paolo latella (8)

PDF
XPeppers e AWS
PPT
AWSUGIT-Promo
PPTX
Data Analysis on AWS
PPT
Amazon Web Services and Docker
PDF
Hybrid Cloud With AWS and Eucalyptus
PDF
Mobile app and disaster recovery with aws
PDF
Cloud Transcoding with Amazon Web Services
PDF
Amazon Web Services and Interact - Workshop Giugno 2013
XPeppers e AWS
AWSUGIT-Promo
Data Analysis on AWS
Amazon Web Services and Docker
Hybrid Cloud With AWS and Eucalyptus
Mobile app and disaster recovery with aws
Cloud Transcoding with Amazon Web Services
Amazon Web Services and Interact - Workshop Giugno 2013
Ad

Recently uploaded (20)

PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPT
tcp ip networks nd ip layering assotred slides
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Introduction to Information and Communication Technology
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
artificial intelligence overview of it and more
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
Cloud-Scale Log Monitoring _ Datadog.pdf
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
Internet___Basics___Styled_ presentation
Unit-1 introduction to cyber security discuss about how to secure a system
The Internet -By the Numbers, Sri Lanka Edition
Paper PDF World Game (s) Great Redesign.pdf
Design_with_Watersergyerge45hrbgre4top (1).ppt
tcp ip networks nd ip layering assotred slides
international classification of diseases ICD-10 review PPT.pptx
Introduction to Information and Communication Technology
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Decoding a Decade: 10 Years of Applied CTI Discipline
QR Codes Qr codecodecodecodecocodedecodecode
Triggering QUIC, presented by Geoff Huston at IETF 123
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
artificial intelligence overview of it and more
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
Cloud-Scale Log Monitoring _ Datadog.pdf
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
introduction about ICD -10 & ICD-11 ppt.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Internet___Basics___Styled_ presentation

CI & CD on Amazon Web Services

  • 1. CI & CD ON AWS Build and deliver products using AWS Sistemi Distribuiti e Cloud Computing Università degli Studi di Roma "Tor Vergata” DICII Paolo Latella
 XPeppers - Cloud & DevOps
 paolo.latella@xpeppers.com @LatellaPaolo
  • 2. WHAT ARE CI AND CD ? • Continuous Integration: ? • Continuous Delivery: ? paolo.latella@xpeppers.com
  • 3. WHAT ARE CI AND CD ? • Continuous Integration: every time somebody commits any change, the entire application is built and a comprehensive set of automated tests is run against it. • Continuous Delivery: more than just a new delivery methodology. It is a whole new paradigm for running a business that depends on software. Continuous Delivery - Jez Humble, David Farley
  • 4. CI/CD AWSTOOLS Code Build Test Provision Deploy Monitor Integration Delivery AWS CodePipeline AWS CodeBuildAWS CodeCommit AWS CodeDeploy AWS CloudFormation AWS OpsWorks Amazon EC2 Container Service AWS Elastic Beanstalk Amazon CloudWatch AWS
 CloudTrail paolo.latella@xpeppers.com
  • 5. CODECOMMIT • Fully managed. • Repositories of any size and any file type. • Has highly available repositories. • Choose the region where your repository should reside. • Supports the standard functionality of Git • Online code tools to browse, edit, and collaborate on projects. paolo.latella@xpeppers.com
  • 6. CODECOMMIT Host git-codecommit.*.amazonaws.com User APKAEIBAERJR2EXAMPLE IdentityFile ~/.ssh/codecommit_rsa git clone ssh://git-codecommit.us- east-1.amazonaws.com/v1/repos/MyDemoRepo my-demo-repo $ ssh-keygen Generate public/private rsa key pair. paolo.latella@xpeppers.com
  • 7. CODEPIPELINE • Graphical user interface to create, configure, and manage your pipeline Fully managed. • Parallel Execution • Integration with CodeDeploy, Lambda, S3, CodeCommit, Beanstalk, Opsworks and third-party tools • Custom action, manual approval, retry, https://aws.amazon.com/codepipeline/product-integrations/ paolo.latella@xpeppers.com
  • 8. CODEPIPELINE Source Specify where source code is stored. Amazon S3, GitHub Build Specify how application should be built. Jenkins and other providers Test Specify how application should be tested. Jenkins, Ghost Inspector and other providers Deploy Specify how application should be deployed. AWS Elastic Beanstalk, AWS CodeDeploy Invoke Specify custom function to invoke. AWS Lambda Actions Pipeline Parallel actions paolo.latella@xpeppers.com
  • 9. CODEBUILD • Fully managed: eliminates the need to set up, patch, update, and manage your own build servers. • On demand: scales on demand to meet your build needs. You pay only for the number of build minutes you consume. • Out of the box: provides preconfigured build environments for the most popular programming languages.All you need to do is point to your build script to start your first build. https://aws.amazon.com/codepipeline/product-integrations/ paolo.latella@xpeppers.com
  • 11. CODEDEPLOY • Coordinates application deployments to Amazon EC2 instances. • Deploy from a GitHub repository or from any local codebase. • Manage deployments across environments, upgrade applications, and perform rolling updates. • Supports Linux and Windows deployments. paolo.latella@xpeppers.com
  • 12. Deployment Group Auto Scaling Group Agent Agent Agent Agent Tags:Name=DeploymentTarget, Value=OurAppOnCodeDeploy Create Deployment AWS CodeDeploy Pull Latest Revision AWS CodeDeploy-ready deployment AppSpec fileApplication + Revision 1 Revision 2 Revision 3 Amazon S3 Bucket CODEDEPLOY paolo.latella@xpeppers.com
  • 13. CODEDEPLOY version: 0.0 os: linux files: - source: Config/config.txt destination: /webapps/Config - source: source destination: /webapps/myApp hooks: BeforeInstall: - location: Scripts/UnzipResourceBundle.sh - location: Scripts/UnzipDataBundle.sh AfterInstall: - location: Scripts/RunResourceTests.sh timeout: 180 ApplicationStart: - location: Scripts/RunFunctionalTests.sh timeout: 3600 ValidateService: - location: Scripts/MonitorService.sh timeout: 3600 runas: codedeployuser Hooks
  • 14. CODEDEPLOY #!/usr/bin/python import boto3 import urllib2 import time CONNECTION_DRAINING_TIMEOUT = 60 print "Get metadata for instance" instance_id=urllib2.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read() availability_zone=urllib2.urlopen('http://169.254.169.254/latest/meta-data/placement/availability-zone').read() region = availability_zone[:-1] asg = boto3.client('autoscaling',region) print 'Trying to move instance ' + instance_id + ' in stand-by' res_asg_of_instance = asg.describe_auto_scaling_instances(InstanceIds=[instance_id]) name_asg_of_instance = res_asg_of_instance['AutoScalingInstances'][0]['AutoScalingGroupName'] state_of_instance = res_asg_of_instance['AutoScalingInstances'][0]['LifecycleState'] if (state_of_instance == 'InService'): res_enter_in_standby = asg.enter_standby(InstanceIds=[instance_id],AutoScalingGroupName=name_asg_of_instance,ShouldDecrementDesiredCapac ity=True) print 'Instance ' + instance_id + 'entering in stand-by' print res_enter_in_standby time.sleep(CONNECTION_DRAINING_TIMEOUT) exit(0) if (state_of_instance == 'Standby'): print 'Instance ' + instance_id + ' already in stand-by' time.sleep(10) exit(0) else: print 'Instance ' + instance_id + ' is in ' + state_of_instance + ' ignoring ...' exit(0) Application Stop ?
  • 17. INFRASTRUCTURE AS CODE Infrastructure Automation Configuration Management Application Deployment I a C paolo.latella@xpeppers.com
  • 18. CLOUDFORMATION • Simplify infrastructure management in the cloud • Perform predictable, repeatable, and automated deployments. • Easily control and track changes to your infrastructure. • Simply JSON orYAML formatted text file that describes the AWS infrastructure paolo.latella@xpeppers.com
  • 19. CLOUDFORMATION CloudFormation Engine Template Stack JSON Syntax Versioning Runtime parameters Dependency Dependencies Conflict resolve All Resources Create/Update/Delete Scriptable Deploy several times Multiregions Dev, Test, Prod paolo.latella@xpeppers.com
  • 20. Amazon
 Route 53 AWS BLUE/GREEN DEPLOYMENT Auto Scaling group Auto Scaling group instances instances template BLUE
 Stack AWS
 CloudFormation GREEN
 Stack 90% 10% alarm IF (alarm) 
 Then Rollback else increment % AWS 
 CodeDeploy
  • 22. GRAZIE! Q&A Paolo Latella
 XPeppers - Agile, Cloud & DevOps
 paolo.latella@xpeppers.com @LatellaPaolo