SlideShare uma empresa Scribd logo
1 de 59
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
John Pignata, Startup Solutions Architect
May 24, 2017
Building a CICD Pipeline for
Container Deployment to
Amazon ECS
What To Expect from This Session
• Review continuous integration, delivery, and deployment
• Using Docker images, Amazon ECS, and Amazon ECR for
CI/CD
• Deployment strategies with Amazon ECS
• Building Docker container images with AWS CodeBuild
• Orchestrating deployment pipelines with AWS CodePipeline
• Demo
Continuous Integration, Delivery,
and Deployment
How can we quickly and reliably
deliver good ideas to our
customers?
Learnings
• Frequency reduces difficulty
• Latency between check-in and production is
waste
• Consistency improves confidence
• Automation over toil
• Empowered developers make happier teams
• Smaller batch sizes are easier to debug
• Faster delivery improves software
development practices
Source Build Test Production
• Version Control
• Branching
• Code Review
• Compilation
• Unit Tests
• Static Analysis
• Packaging
• Integration Tests
• Load Tests
• Security Tests
• Acceptance
Tests
• Deployment
• Monitoring
• Measuring
• Validation
Continuous Integration
Continuous Delivery
Continuous Deployment
Source Build Test Production
Feedback
Docker Images
Packaged Application
Code and Runtime
Dependencies
Reproducible
Immutable
Portable
1c2acd7c
8ab2ba66
91bd52b7
d2cccfda
Image Layers
microservice:latest
1c2acd7c
8ab2ba66
91bd52b7
d2cccfda
microservice:latestDockerfile
FROM amazonlinux:2017.03
RUN yum install –y nginx
COPY ./app /bin/app
CMD [”/bin/app”]
microservice:1.0.0
microservice:1.1.0
microservice:1.1.1
microservice:1.2.0
Development CI UAT Production
Best Practices
• Pin external dependencies to specific
versions for reproducibility
• Package only the runtime requirements for
production
• Minimize changes in each layer to maximize
cache-ability
• Maintain a .dockerignore file to exclude
unneeded files from the image
Building Docker Images
AWS CodeBuild
Build and test code with continuous
scaling with pay-as-you-go pricing
• Build and test projects across platforms and runtimes
including Java, Ruby, Python, Android, Docker, etc.
• Never pay for idle time
• Fully extensible to other platforms through custom build
environments
Build Specification – Phases
Phase Description Examples
install Installation of packages into the
environment
Install testing frameworks
e.g. RSpec, Mocha
pre_build Commands to run before the build
such as login steps or installation of
dependencies
Log in to Amazon ECR.
run Ruby bundler or npm
build Sequence to run the build such as
compilation and/or running tests
Run go build, sbt, Mocha,
RSpec
post_build Commands to run after a build on
success or failure
Build a JAR via Maven or
push a Docker image to
Amazon ECR
Build Specification – Docker
version: 0.2
phases:
pre_build:
commands:
- $(aws ecr get-login)
build:
commands:
- docker build –t ʺ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}ʺ .
post_build:
commands:
- docker push ʺ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}ʺ
Best Practices
• Minimize your spend on build resources
• AWS CodeBuild
• EC2 Spot Instances
• Tag output artifacts to source control
revisions (e.g. git SHA, semantic version)
• Avoid using a “latest” or “production” tag
• Optimize for build speed
• Collocate build process with its artifact
repository
Deploying Docker Containers
Amazon EC2 Container Service (ECS)
EC2 INSTANCES
ECS
AGENT
ECS
AGENT
Amazon
ECS
ECS
AGENT
DEPLOYMENT
AUTOMATION
Deployment – In Place – Doubling
Availability Zone Availability Zone
Scenario
Service’s task definition is
updated to a new revision with
parameters:
Desired Count = 2
Minimum Healthy Percent = 100%
Maximum Percent = 200%
These settings permit the service
to grow to double its desired size
during deployment
EXISTING EXISTING
Deployment – In Place – Doubling
Availability Zone Availability Zone
Two new tasks are started
growing the number of tasks to
200% of its desired count which is
the maximum permitted
EXISTING EXISTINGNEW NEW
Desired Count = 2
Minimum Healthy Percent = 100%
Maximum Percent = 200%
Deployment – In Place – Doubling
Availability Zone Availability Zone
After the new tasks are verified to
be healthy by the Elastic Load
Balancer health check, the two
previous tasks with the older task
definition are drained and stopped
NEW NEW
Desired Count = 2
Minimum Healthy Percent = 100%
Maximum Percent = 200%
Deployment – In Place – Rolling
Availability Zone Availability Zone
Scenario
Service’s task definition is
updated to a new revision with
parameters:
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
These settings constrain the
service to not exceed its desired
size but allows it to halve the
number of tasks during
deployment
EXISTING EXISTING
Deployment – In Place – Rolling
Availability Zone Availability Zone
First, an existing task is stopped
which brings the healthy
percentage of the service to 50%
and makes room on the cluster for
new tasks
EXISTING
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
Deployment – In Place – Rolling
Availability Zone Availability Zone
A task using the new task
definition is started bringing the
service back to 100%
EXISTING
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
NEW
Deployment – In Place – Rolling
Availability Zone Availability Zone
After the new task is verified to be
healthy by the Elastic Load
Balancer health check, the next
existing task with the older task
definition is drained and stopped
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
NEW
Deployment – In Place – Rolling
Availability Zone Availability Zone
The second new task is started on
the cluster bringing the service
back to 100%
NEW NEW
Desired Count = 2
Minimum Healthy Percent = 50%
Maximum Percent = 100%
Deployment – Canary
Availability Zone Availability Zone
Scenario
The new revision runs as a small
subset of production by deploying
a canary service in the same
target group
Deployment is completed by
updating the primary service’s
task definition and scaling down
the canary service. EXISTING EXISTINGEXISTING
Deployment – Canary
Availability Zone Availability Zone
A standalone service with the new
task definition is deployed using
the same Application Load
Balancer target group of the
existing service
EXISTING EXISTINGEXISTING CANARY
Deployment – Canary
Availability Zone Availability Zone
After some period of monitoring
the metrics from the canary
instance, the existing service’s
task definition is updated to the
new revision
NEW NEWNEW CANARY
Deployment – Canary
Availability Zone Availability Zone
After the deployment, all tasks are
running the same task definition
with the new revision of the
application and the canary can be
destroyed
NEW NEWNEW
Deployment – Blue/Green – DNS Swap
Availability Zone
EXISTING EXISTING
www.myproduct.com
Scenario
Two services are defined each
with their own Application Load
Balancer
Deployment is completed by
swapping the Route 53 alias
record between the two
Application Load Balancers
Availability Zone
Deployment – Blue/Green – DNS Swap
Availability Zone
EXISTING EXISTING
www.myproduct.com
An identical Application Load
Balancer and a service with a task
definition using the new revision is
deployed
Availability Zone
NEW NEW
next.myproduct.com
Deployment – Blue/Green – DNS Swap
Availability Zone
EXISTING EXISTING
next.myproduct.com
After automated or manual
testing, the deployment is
completed by swapping the Route
53 alias record between the two
Application Load Balancers
Availability Zone
NEW NEW
www.myproduct.com
Deployment – Blue/Green – DNS Swap
Availability Zone
The previous service and its
Application Load Balancer can
then be destroyed
Availability Zone
NEW NEW
www.myproduct.com
Deployment – Blue/Green – Target Group Swap
Availability Zone
EXISTING EXISTING
Scenario
Two services are defined each
with their own target group
registered in the same Application
Load Balancer using Host-based
routing
Deployment is completed by
swapping the listener rules
between the two target groups
Availability Zone
Deployment – Blue/Green – Target Group Swap
Availability Zone
EXISTING EXISTING
The second service is deployed
with a new target group and
registered to the same Application
Load Balancer
Using Host-based routing, requests
to www.myproduct.com are
directed to our blue service while
requests to next.myproduct.com
are directed to our green service NEW NEW
Availability Zone
Deployment – Blue/Green – Target Group Swap
Availability Zone
After automated or manual testing,
the deployment can be completed
by swapping the listener rules on
the Application Load Balancer and
sending traffic to the green service
NEW NEW
Availability Zone
EXISTING EXISTING
Deployment – Blue/Green – Target Group Swap
Availability Zone
The previous service and its target
group can then be destroyed
NEW NEW
Availability Zone
Best Practices
• Use Elastic Load Balancing health checks to
prevent botched deploys
• For higher confidence, integrate automated
testing against a new environment or
monitoring of a canary before cutover
• Ensure your application can function against
the same backend schema for adjacent
releases
Building a Deployment Pipeline
The automated manifestation
of the process for getting your
software from version control
and into the hands of your
customers
Deployment Pipeline
Source Build Test Production
AWS CodePipeline
Model deployment pipelines through a visual workflow
interface which build, test, and deploy new revisions on
code changes
• Integrates with AWS services, open source and third
party tools for building, testing, and deploying code
• Extend deployment pipelines with custom logic through
AWS Lambda functions or custom actions
• Allows operators to block transitions to “stop the line”
and manual approval steps
Source
Source
GitHub
Build
Build
AWS CodeBuild
Deploy
Deploy
AWS CloudFormation
Action
Stage
Pipeline
Transition
Developers Version Control
Repository
Test &
Deployment
Manager
Image Build
Service
Infrastructure
Provisioning
Container
Scheduling &
Orchestration
Container Image
Repository
Developers AWS
CodeCommit
AWS
CodePipeline
AWS CodeBuild
AWS
CloudFormation
Amazon ECS
Amazon ECR
Developers Github Jenkins
Infrastructure
Provisioning
Container
Scheduling &
Orchestration
Container Image
Repository
AWS
CloudFormation
Amazon ECS
Amazon ECR
Developers Github Jenkins
Demo
Reference Architecture
https://github.com/awslabs/ecs-refarch-continuous-deployment
Thank You!
Q&A

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
Building a CI/CD Pipeline for Containers - DevDay Los Angeles 2017
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
 
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
Deep Dive on Elastic Load Balancing
Deep Dive on Elastic Load BalancingDeep Dive on Elastic Load Balancing
Deep Dive on Elastic Load Balancing
 
New AWS Services
New AWS ServicesNew AWS Services
New AWS Services
 
(DVO313) Building Next-Generation Applications with Amazon ECS
(DVO313) Building Next-Generation Applications with Amazon ECS(DVO313) Building Next-Generation Applications with Amazon ECS
(DVO313) Building Next-Generation Applications with Amazon ECS
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic Beanstalk
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
Cloud-Native DevOps: Simplifying application lifecycle management with AWS | ...
Cloud-Native DevOps: Simplifying application lifecycle management with AWS | ...Cloud-Native DevOps: Simplifying application lifecycle management with AWS | ...
Cloud-Native DevOps: Simplifying application lifecycle management with AWS | ...
 
AWS re:Invent 2016: Enabling DevOps for an Enterprise with AWS Service Catalo...
AWS re:Invent 2016: Enabling DevOps for an Enterprise with AWS Service Catalo...AWS re:Invent 2016: Enabling DevOps for an Enterprise with AWS Service Catalo...
AWS re:Invent 2016: Enabling DevOps for an Enterprise with AWS Service Catalo...
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and Scheduling
 
CI/CD on AWS Deploy Everything All the Time
CI/CD on AWS Deploy Everything All the TimeCI/CD on AWS Deploy Everything All the Time
CI/CD on AWS Deploy Everything All the Time
 
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
 
DevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous DeliveryDevOps On AWS - Deep Dive on Continuous Delivery
DevOps On AWS - Deep Dive on Continuous Delivery
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
 
(DVO202) DevOps at Amazon: A Look At Our Tools & Processes
(DVO202) DevOps at Amazon: A Look At Our Tools & Processes(DVO202) DevOps at Amazon: A Look At Our Tools & Processes
(DVO202) DevOps at Amazon: A Look At Our Tools & Processes
 

Semelhante a Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AWS Online Tech Talks

Building a CICD Pipeline for Containers - DevDay Austin 2017
Building a CICD Pipeline for Containers - DevDay Austin 2017Building a CICD Pipeline for Containers - DevDay Austin 2017
Building a CICD Pipeline for Containers - DevDay Austin 2017
Amazon Web Services
 

Semelhante a Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AWS Online Tech Talks (20)

Building a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to ContainersBuilding a CICD Pipeline for Deploying to Containers
Building a CICD Pipeline for Deploying to Containers
 
SRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and DockerSRV412 Deep Dive on CICD and Docker
SRV412 Deep Dive on CICD and Docker
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
Building a CICD pipeline for deploying to containers
Building a CICD pipeline for deploying to containersBuilding a CICD pipeline for deploying to containers
Building a CICD pipeline for deploying to containers
 
Building a CICD Pipeline for Containers - DevDay Austin 2017
Building a CICD Pipeline for Containers - DevDay Austin 2017Building a CICD Pipeline for Containers - DevDay Austin 2017
Building a CICD Pipeline for Containers - DevDay Austin 2017
 
Building a CICD Pipeline for deploying on Containers
Building a CICD Pipeline for deploying on ContainersBuilding a CICD Pipeline for deploying on Containers
Building a CICD Pipeline for deploying on Containers
 
Deep Dive with Amazon EC2 Container Service Hands-on Workshop
Deep Dive with Amazon EC2 Container Service Hands-on WorkshopDeep Dive with Amazon EC2 Container Service Hands-on Workshop
Deep Dive with Amazon EC2 Container Service Hands-on Workshop
 
CON302_Building a CICD Pipeline for Containers on Amazon ECS
CON302_Building a CICD Pipeline for Containers on Amazon ECSCON302_Building a CICD Pipeline for Containers on Amazon ECS
CON302_Building a CICD Pipeline for Containers on Amazon ECS
 
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
Deep Dive on Microservices and Docker - AWS Summit Cape Town 2017
 
Deep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECSDeep Dive on Microservices and Amazon ECS
Deep Dive on Microservices and Amazon ECS
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
Tips to achieve continuous integration/delivery using HP ALM, Jenkins, and S...
 Tips to achieve continuous integration/delivery using HP ALM, Jenkins, and S... Tips to achieve continuous integration/delivery using HP ALM, Jenkins, and S...
Tips to achieve continuous integration/delivery using HP ALM, Jenkins, and S...
 
MidSem
MidSemMidSem
MidSem
 
Managing Your Application Lifecycle on AWS: Continuous Integration and Deploy...
Managing Your Application Lifecycle on AWS: Continuous Integration and Deploy...Managing Your Application Lifecycle on AWS: Continuous Integration and Deploy...
Managing Your Application Lifecycle on AWS: Continuous Integration and Deploy...
 
Containers and Kubernetes
Containers and KubernetesContainers and Kubernetes
Containers and Kubernetes
 
Continuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesContinuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar Series
 
Running Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWSRunning Containerised Applications at Scale on AWS
Running Containerised Applications at Scale on AWS
 
AWS re:Invent 2016: Infrastructure Continuous Delivery Using AWS CloudFormati...
AWS re:Invent 2016: Infrastructure Continuous Delivery Using AWS CloudFormati...AWS re:Invent 2016: Infrastructure Continuous Delivery Using AWS CloudFormati...
AWS re:Invent 2016: Infrastructure Continuous Delivery Using AWS CloudFormati...
 
A Bit of Everything Chef
A Bit of Everything ChefA Bit of Everything Chef
A Bit of Everything Chef
 
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipelineKubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
KubeCon EU 2016: Leveraging ephemeral namespaces in a CI/CD pipeline
 

Mais de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Mais de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Building a CICD Pipeline for Container Deployment to Amazon ECS - May 2017 AWS Online Tech Talks

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. John Pignata, Startup Solutions Architect May 24, 2017 Building a CICD Pipeline for Container Deployment to Amazon ECS
  • 2. What To Expect from This Session • Review continuous integration, delivery, and deployment • Using Docker images, Amazon ECS, and Amazon ECR for CI/CD • Deployment strategies with Amazon ECS • Building Docker container images with AWS CodeBuild • Orchestrating deployment pipelines with AWS CodePipeline • Demo
  • 4.
  • 5.
  • 6. How can we quickly and reliably deliver good ideas to our customers?
  • 7. Learnings • Frequency reduces difficulty • Latency between check-in and production is waste • Consistency improves confidence • Automation over toil • Empowered developers make happier teams • Smaller batch sizes are easier to debug • Faster delivery improves software development practices
  • 8. Source Build Test Production • Version Control • Branching • Code Review • Compilation • Unit Tests • Static Analysis • Packaging • Integration Tests • Load Tests • Security Tests • Acceptance Tests • Deployment • Monitoring • Measuring • Validation
  • 9. Continuous Integration Continuous Delivery Continuous Deployment Source Build Test Production Feedback
  • 11. Packaged Application Code and Runtime Dependencies Reproducible Immutable Portable
  • 15. Development CI UAT Production
  • 16. Best Practices • Pin external dependencies to specific versions for reproducibility • Package only the runtime requirements for production • Minimize changes in each layer to maximize cache-ability • Maintain a .dockerignore file to exclude unneeded files from the image
  • 18.
  • 19. AWS CodeBuild Build and test code with continuous scaling with pay-as-you-go pricing • Build and test projects across platforms and runtimes including Java, Ruby, Python, Android, Docker, etc. • Never pay for idle time • Fully extensible to other platforms through custom build environments
  • 20. Build Specification – Phases Phase Description Examples install Installation of packages into the environment Install testing frameworks e.g. RSpec, Mocha pre_build Commands to run before the build such as login steps or installation of dependencies Log in to Amazon ECR. run Ruby bundler or npm build Sequence to run the build such as compilation and/or running tests Run go build, sbt, Mocha, RSpec post_build Commands to run after a build on success or failure Build a JAR via Maven or push a Docker image to Amazon ECR
  • 21. Build Specification – Docker version: 0.2 phases: pre_build: commands: - $(aws ecr get-login) build: commands: - docker build –t ʺ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}ʺ . post_build: commands: - docker push ʺ${REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}ʺ
  • 22. Best Practices • Minimize your spend on build resources • AWS CodeBuild • EC2 Spot Instances • Tag output artifacts to source control revisions (e.g. git SHA, semantic version) • Avoid using a “latest” or “production” tag • Optimize for build speed • Collocate build process with its artifact repository
  • 24.
  • 25.
  • 26. Amazon EC2 Container Service (ECS) EC2 INSTANCES ECS AGENT ECS AGENT Amazon ECS ECS AGENT DEPLOYMENT AUTOMATION
  • 27. Deployment – In Place – Doubling Availability Zone Availability Zone Scenario Service’s task definition is updated to a new revision with parameters: Desired Count = 2 Minimum Healthy Percent = 100% Maximum Percent = 200% These settings permit the service to grow to double its desired size during deployment EXISTING EXISTING
  • 28. Deployment – In Place – Doubling Availability Zone Availability Zone Two new tasks are started growing the number of tasks to 200% of its desired count which is the maximum permitted EXISTING EXISTINGNEW NEW Desired Count = 2 Minimum Healthy Percent = 100% Maximum Percent = 200%
  • 29. Deployment – In Place – Doubling Availability Zone Availability Zone After the new tasks are verified to be healthy by the Elastic Load Balancer health check, the two previous tasks with the older task definition are drained and stopped NEW NEW Desired Count = 2 Minimum Healthy Percent = 100% Maximum Percent = 200%
  • 30. Deployment – In Place – Rolling Availability Zone Availability Zone Scenario Service’s task definition is updated to a new revision with parameters: Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100% These settings constrain the service to not exceed its desired size but allows it to halve the number of tasks during deployment EXISTING EXISTING
  • 31. Deployment – In Place – Rolling Availability Zone Availability Zone First, an existing task is stopped which brings the healthy percentage of the service to 50% and makes room on the cluster for new tasks EXISTING Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100%
  • 32. Deployment – In Place – Rolling Availability Zone Availability Zone A task using the new task definition is started bringing the service back to 100% EXISTING Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100% NEW
  • 33. Deployment – In Place – Rolling Availability Zone Availability Zone After the new task is verified to be healthy by the Elastic Load Balancer health check, the next existing task with the older task definition is drained and stopped Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100% NEW
  • 34. Deployment – In Place – Rolling Availability Zone Availability Zone The second new task is started on the cluster bringing the service back to 100% NEW NEW Desired Count = 2 Minimum Healthy Percent = 50% Maximum Percent = 100%
  • 35. Deployment – Canary Availability Zone Availability Zone Scenario The new revision runs as a small subset of production by deploying a canary service in the same target group Deployment is completed by updating the primary service’s task definition and scaling down the canary service. EXISTING EXISTINGEXISTING
  • 36. Deployment – Canary Availability Zone Availability Zone A standalone service with the new task definition is deployed using the same Application Load Balancer target group of the existing service EXISTING EXISTINGEXISTING CANARY
  • 37. Deployment – Canary Availability Zone Availability Zone After some period of monitoring the metrics from the canary instance, the existing service’s task definition is updated to the new revision NEW NEWNEW CANARY
  • 38. Deployment – Canary Availability Zone Availability Zone After the deployment, all tasks are running the same task definition with the new revision of the application and the canary can be destroyed NEW NEWNEW
  • 39. Deployment – Blue/Green – DNS Swap Availability Zone EXISTING EXISTING www.myproduct.com Scenario Two services are defined each with their own Application Load Balancer Deployment is completed by swapping the Route 53 alias record between the two Application Load Balancers Availability Zone
  • 40. Deployment – Blue/Green – DNS Swap Availability Zone EXISTING EXISTING www.myproduct.com An identical Application Load Balancer and a service with a task definition using the new revision is deployed Availability Zone NEW NEW next.myproduct.com
  • 41. Deployment – Blue/Green – DNS Swap Availability Zone EXISTING EXISTING next.myproduct.com After automated or manual testing, the deployment is completed by swapping the Route 53 alias record between the two Application Load Balancers Availability Zone NEW NEW www.myproduct.com
  • 42. Deployment – Blue/Green – DNS Swap Availability Zone The previous service and its Application Load Balancer can then be destroyed Availability Zone NEW NEW www.myproduct.com
  • 43. Deployment – Blue/Green – Target Group Swap Availability Zone EXISTING EXISTING Scenario Two services are defined each with their own target group registered in the same Application Load Balancer using Host-based routing Deployment is completed by swapping the listener rules between the two target groups Availability Zone
  • 44. Deployment – Blue/Green – Target Group Swap Availability Zone EXISTING EXISTING The second service is deployed with a new target group and registered to the same Application Load Balancer Using Host-based routing, requests to www.myproduct.com are directed to our blue service while requests to next.myproduct.com are directed to our green service NEW NEW Availability Zone
  • 45. Deployment – Blue/Green – Target Group Swap Availability Zone After automated or manual testing, the deployment can be completed by swapping the listener rules on the Application Load Balancer and sending traffic to the green service NEW NEW Availability Zone EXISTING EXISTING
  • 46. Deployment – Blue/Green – Target Group Swap Availability Zone The previous service and its target group can then be destroyed NEW NEW Availability Zone
  • 47. Best Practices • Use Elastic Load Balancing health checks to prevent botched deploys • For higher confidence, integrate automated testing against a new environment or monitoring of a canary before cutover • Ensure your application can function against the same backend schema for adjacent releases
  • 49. The automated manifestation of the process for getting your software from version control and into the hands of your customers Deployment Pipeline
  • 50. Source Build Test Production
  • 51. AWS CodePipeline Model deployment pipelines through a visual workflow interface which build, test, and deploy new revisions on code changes • Integrates with AWS services, open source and third party tools for building, testing, and deploying code • Extend deployment pipelines with custom logic through AWS Lambda functions or custom actions • Allows operators to block transitions to “stop the line” and manual approval steps
  • 53. Developers Version Control Repository Test & Deployment Manager Image Build Service Infrastructure Provisioning Container Scheduling & Orchestration Container Image Repository
  • 57. Demo