Professional Documents
Culture Documents
CICD at Scale Best Practices With AWS DevOps Services - Loh Yiang Meng
CICD at Scale Best Practices With AWS DevOps Services - Loh Yiang Meng
CICD at Scale Best Practices With AWS DevOps Services - Loh Yiang Meng
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
• What is DevOps?
• Pipeline automation
• Safe deployments
• Demo
What is DevOps?
DevOps =
What is DevOps?
DevOps = Culture + Practices + Tools
What is DevOps?
DevOps = Culture + Practices + Tools
What is DevOps?
DevOps = Culture + Practices + Tools
What is DevOps?
DevOps = Culture + Practices + Tools
What is DevOps at scale?
Pre-production Production
Artifacts
What is DevOps at scale?
Pre-production Production
Pipeline
automation
Best practices for CI/CD
Pipeline
automation
Release process stages
AWS CodePipeline
AWS CodePipeline
Bitbucket
AWS CodePipeline: Supported triggers
Automatically kick off release
Continuous integration
env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"
Variables to be used by phases of build
phases:
install:
runtime-versions:
java: corretto8
build:
commands: Execute build command
- echo Build started on `date`
- mvn install
post_build:
commands:
- echo Test started on `date` Execute unit tests
- mvn surefire-report:report
reports:
SurefireReports:
files:
- '**/*'
base-directory: 'target/surefire-reports’
artifacts:
type: zip
files:
- target/messageUtil-1.0.jar
Create and store build artifacts in
discard-paths: yes Amazon S3
AWS CodeBuild
v0.1 – each build cmd in separate shell
version: 0.2
v0.2 – each build cmd in same shell
env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"
Variables to be used by phases of build
phases:
install:
runtime-versions:
java: corretto8
build:
commands: Execute build command
- echo Build started on `date`
- mvn install
post_build:
commands:
- echo Test started on `date` Execute unit tests
- mvn surefire-report:report
reports:
SurefireReports:
files:
- '**/*'
base-directory: 'target/surefire-reports’
artifacts:
type: zip
files:
- target/messageUtil-1.0.jar
Create and store build artifacts in
discard-paths: yes Amazon S3
AWS CodeBuild
v0.1 – each build cmd in separate shell
version: 0.2
v0.2 – each build cmd in same shell
env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"
Variables to be used by phases of build
phases:
install:
runtime-versions:
java: corretto8
build:
commands: Execute build command
- echo Build started on `date`
- mvn install
post_build:
commands:
- echo Test started on `date` Execute unit tests
- mvn surefire-report:report
reports:
SurefireReports:
files:
- '**/*' Reports output location
base-directory: 'target/surefire-reports’
artifacts:
type: zip
files:
- target/messageUtil-1.0.jar
Create and store build artifacts in
discard-paths: yes Amazon S3
AWS CodeBuild
See breakdown of
individual unit tests,
status of the tests,
duration, and messages
from the tests
Best practices for CI/CD
Pipeline
automation
Continuous deployment goals
Continuous deployment
One at a time
v2 v1 v1 v1 v1 v1 Agent Agent
Or
Half at a time Prod deployment group
v2 v2 v2 v1 v1 v1
All at once
100%
production
traffic
CodeDeploy: Amazon ECS blue/green deployment
100%
production
traffic
100%
production
traffic
100%
test
traffic Green
target
group
CodeDeploy: Amazon ECS blue/green deployment
Provision green tasks
100%
production
traffic
100%
test
traffic Green Green tasks:
target v2 code
group
CodeDeploy: Amazon ECS blue/green deployment
Shift test traffic to green; run validation tests against test endpoint
100%
production
traffic
100%
test Green
traffic Green tasks:
target v2 code
group
CodeDeploy: Amazon ECS blue/green deployment
Shift production traffic to green; roll back in case of alarm
100%
production
traffic
100%
test Green
traffic Green tasks:
target v2 code
group
CodeDeploy: Amazon ECS blue/green deployment
Drain blue tasks
100%
production
traffic
Blue target
group
100%
test Green
traffic Green tasks:
target v2 code
group
AWS CodeDeploy: AWS Lambda deployments
AWS CodeDeploy: AWS Lambda deployments
AWS CodeDeploy: AWS Lambda deployments
AWS CodeDeploy: AWS Lambda deployments
Best practices for CI/CD
Pipeline
automation
What is DevOps at scale?
Pre-production Production
Infrastructure as code
new ecs.LoadBalancedFargateService(
this, "FargateService", {
cluster,
image: ecs.DockerHub.image("amazon/amazon-ecs-sample"),
});
}
}
new ecs.LoadBalancedFargateService(
this, "FargateService", {
cluster,
image: ecs.DockerHub.image("amazon/amazon-ecs-sample"),
});
}
}
new ecs.LoadBalancedFargateService(
this, "FargateService", {
cluster,
image: ecs.DockerHub.image("amazon/amazon-ecs-sample"),
});
}
}
Amazon Amazon Amazon AWS Amazon Amazon Amazon Amazon AWS Amazon Amazon Amazon Amazon
EC2 EKS ECR Lambda S3
EBS EFS S3 Backup Aurora ElastiCache Redshift DynamoDB
Glacier
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps pipeline
AWS Cloud • Saved time and costs
CodeCommit • Everything is
automated
Amazon
• Used Secrets Manager
to store the secure
CodeBuild
ECR
configs
CodePipeline
Lambda
CodeDeploy
• Container Insights
and CloudWatch
Amazon Secrets
provided
EKS
Container
Manager
observability
“… and we made it more interesting by
integrating Alexa with AWS CodePipeline.”
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DevOps pipeline v2
AWS Cloud
CodeCommit
Alexa Amazon
skill Echo
CodeBuild Amazon
ECR
CodePipeline
Lambda
Lambda function
Alexa to trigger
CodeDeploy the deployments
quickly and easily
Amazon Secrets
EKS Manager
Container
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Learn to build modern applications on AWS
Resources created by the experts at AWS to help you build and validate developer skills
Explore tailored Build cloud skills with Demonstrate expertise Find entry-level cloud
learning paths for 550+ free digital with an industry- talent with AWS
customers and training courses, or dive recognized credential Academy and AWS
partners deep with classroom re/Start
training
aws.amazon.com/training
Thank you!
Loh Yiang Meng
ymloh@amazon.com
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.