SlideShare una empresa de Scribd logo
1 de 57
P U B L I C S E C T O R
S U M M I T
WASHINGTON, DC
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
CI/CD for Serverless and
Containerized Applications
Len Henry
Senior Solutions
Architect
AWS/WWPS
Education
3 0 1 5 9 4
Justin Almquist
Senior Software
Engineer &
Development Team
Lead
Computing and
Analytics
Troy Zuroske
Software
Engineer/Cloud
Architect Computing
and Analytics
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Agenda
CI/CD for modern applications
Continuous integration
Continuous deployment
Infrastructure as code
CI/CD for a Real-Time Deep Learning Pipeline
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
What is a modern application?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Approaches to modern application development
• Simplify environment management
• Reduce the impact of code changes
• Automate operations
• Accelerate the delivery of services
• Gain insight across resources and applications
• Protect customers and the business
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Approaches to modern application development
• Simplify environment management with serverless technologies
• Reduce the impact of code changes with microservice architectures
• Automate operations by modeling applications & infrastructure as
code
• Accelerate the delivery of services with CI/CD
• Gain insight across resources and applications by enabling
observability
• Protect customers and the business with end-to-end security &
compliance
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Approaches to modern application development
• Simplify environment management with serverless technologies
• Reduce the impact of code changes with microservice architectures
• Automate operations by modeling applications & infrastructure as
code
• Accelerate the delivery of services with CI/CD
• Gain insight across resources and applications by enabling
observability
• Protect customers and the business with end-to-end security &
compliance
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Approaches to modern application development
Serverless containers
Long-running
Abstracts the OS
Fully managed orchestration
Fully managed cluster scaling
Serverless functions
Event-driven
Many language runtimes
Data source integrations
No server management
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Approaches to modern application development
• Simplify environment management with serverless technologies
• Reduce the impact of code changes with microservice architectures
• Automate operations by modeling applications & infrastructure as
code
• Accelerate the delivery of services with CI/CD
• Gain insight across resources and applications by enabling
observability
• Protect customers and the business with end-to-end security &
compliance
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Release process stages
Source Build Test Production
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Release process stages
Source Build Test Production
• Integration tests
with other
systems
• Load testing
• UI tests
• Security testing
• Check-in source
code such as .java
files
• Peer review new
code
• Compile code
• Unit tests
• Style checkers
• Create container
images and
function
deployment
packages
• Deployment to
production
environments
• Monitor code in
production to
quickly detect
errors
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Effects of CI/CD
Source: 2018 DORA State of DevOps Report
Deployment frequency Weekly – monthly Hourly – daily
Change lead time One – six months One – seven days
Change failure rate 46-60% 0-15%
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Pillars of releasing modern applications
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Pillars of releasing modern applications
Continuous
integration
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Continuous integration goals
Source Build Test Production
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Continuous integration goals
1. Automatically kick off a new release when new code is checked in
2. Build and test code in a consistent, repeatable environment
3. Continually have an artifact ready for deployment
4. Continually close feedback loop when build fails
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
AWS CodePipeline
• Continuous delivery service for fast and reliable
application updates
• Model and visualize your software release
process
• Builds, tests, and deploys your code every time
there is a code change
• Integrates with third-party tools and AWS
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
AWS CodePipeline: Supported sources
Pick branch
AWS CodeCommit
GitHub
Pick object or folder
Amazon Simple
Storage Service
(Amazon S3)
Pick Docker tag
Amazon Elastic
Container
Registry (Amazon
ECR)
Automatically kick off release and pull latest source code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
AWS CodeBuild
• Fully managed build service that compiles
source code, runs tests, and produces software
packages
• Scales continuously and processes multiple
builds concurrently
• No build servers to manage
• Pay by the minute, only for the compute
resources you use
• Monitor builds through Amazon CloudWatch
Events
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
AWS CodeBuild
• Each build runs in a new Docker container for a
consistent, immutable environment
• Docker and AWS Command Line Interface
(AWS CLI) are installed in every official
CodeBuild image
• Provide custom build environments suited to
your needs through the use of Docker images
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Pillars of releasing modern applications
Continuous
deployment
Continuous
integration
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Continuous deployment goals
Source Build Test Production
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Continuous deployment goals
1. Automatically deploy new changes to staging environments for
testing
2. Deploy to production safely without impacting customers
3. Deliver to customers faster: Increase deployment frequency and
reduce change lead time and change failure rate
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
AWS CodeDeploy
• Automates code deployments to any instance
and AWS Lambda
• Handles the complexity of updating your
applications
• Avoids downtime during application
deployment
• Rolls back automatically if failure detected
• Deploys to Amazon Elastic Compute Cloud
(Amazon EC2), Lambda, or on-premises servers
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
CodeDeploy-Lambda deployments
• Shifts traffic using Lambda function weighted aliases
• Choose canary (“shift 10% of traffic for 10 minutes, then shift
rest”) or linear (“shift 10% more traffic every 10 minutes”)
• Validation “hooks” enable testing at each stage of the
deployment
• Fast rollback in seconds if case of hook failure or CloudWatch
alarms
• Monitor deployment status and history via console, API, Amazon
Simple Notification Service (Amazon SNS) notifications, and
CloudWatch Events
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
AWS CodeDeploy
AWS CodeDeploy now automates
blue-green deployments to AWS
Fargate and Amazon Elastic
Container Service (Amazon ECS)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Container image tagging for deployments
• Docker tags are resolved when each container starts, not just
during deployments
• Deploying “latest” or “prod” can result in untested code in
production after a scale-out event
• Use unique “immutable” tags for deployments
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Pillars of releasing modern applications
Infrastructure
as code
Continuous
deployment
Continuous
integration
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Infrastructure as code goals
Source Build Test
Productio
n
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Infrastructure as code goals
1. Make infrastructure changes repeatable and predictable
2. Release infrastructure changes using the same tools as code
changes
3. Replicate production environment in a staging environment to
enable continuous testing
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Continuous testing with infrastructure as code
Validate an artifact
(Build stage)
• Unit tests
• Static analysis
• Mocked dependencies and
environments
• Vulnerability image scans
Validate an environment
(Test stages)
• Integration tests against real
dependencies and real
environments
• Load testing
• Penetration testing
• Monitoring to test impact of
deployments on
environment
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Release infrastructure-as-code
“Master”
branch
Prepare
template
Create & execute
change set
Create & execute
change set
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Model function environments with AWS
Serverless Application Model (SAM)
https://aws.amazon.com/serverless/sam/
• Open source framework for building serverless
applications on AWS
• Shorthand syntax to express functions, APIs,
databases, and event source mappings
• Transforms and expands SAM syntax into AWS
CloudFormation syntax on deployment
• Supports all AWS CloudFormation resource types
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Model container environments with AWS
Cloud Development Kit (CDK)
• Open source framework to define cloud
infrastructure in Typescript
• Provides library of higher-level resource types
(“construct” classes) that have AWS best
practices built in by default, packaged as npm
modules
• Provisions resources with AWS CloudFormation
• Supports all AWS CloudFormation resource
types
AWS
CDK
https://awslabs.github.io/aws-cdk
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
CDK template
import ec2 = require('@aws-cdk/aws-ec2');
import ecs = require('@aws-cdk/aws-ecs');
import cdk = require('@aws-cdk/cdk');
class BonjourFargate extends cdk.Stack {
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
new ecs.LoadBalancedFargateService(
this, "FargateService", {
cluster,
image: ecs.DockerHub.image("amazon/amazon-ecs-sample"),
});
}
}
const app = new cdk.App();
new BonjourFargate(app, 'Bonjour');
app.run();
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
CDK template
import ec2 = require('@aws-cdk/aws-ec2');
import ecs = require('@aws-cdk/aws-ecs');
import cdk = require('@aws-cdk/cdk');
class BonjourFargate extends cdk.Stack {
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
new ecs.LoadBalancedFargateService(
this, "FargateService", {
cluster,
image: ecs.DockerHub.image("amazon/amazon-ecs-sample"),
});
}
}
const app = new cdk.App();
new BonjourFargate(app, 'Bonjour');
app.run();
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
CDK template
import ec2 = require('@aws-cdk/aws-ec2');
import ecs = require('@aws-cdk/aws-ecs');
import cdk = require('@aws-cdk/cdk');
class BonjourFargate extends cdk.Stack {
constructor(parent: cdk.App, name: string, props?: cdk.StackProps) {
super(parent, name, props);
const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 });
const cluster = new ecs.Cluster(this, 'Cluster', { vpc });
new ecs.LoadBalancedFargateService(
this, "FargateService", {
cluster,
image: ecs.DockerHub.image("amazon/amazon-ecs-sample"),
});
}
}
const app = new cdk.App();
new BonjourFargate(app, 'Bonjour');
app.run();
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Model pipelines with AWS CDK
• Minimize copy-and-paste by using object-oriented language
• Define microservice pipeline “shape” in one class, then re-use it
across many pipelines
• AWS CDK includes many high-level constructs for modeling a
CodePipeline pipeline, including automatically configuring AWS
Identity and Access Management (IAM) role policies
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Pillars of releasing modern applications
Infrastructure
as code
Continuous
deployment
Continuous
integration
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
Draft
CI/CD for a Real-Time Deep Learning Pipeline
Justin Almquist,
Senior Software Engineer PNNL
Troy Zuroske,
Software Engineer PNNL
June 19, 2019
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
41
Introductions
Justin Almquist
Senior Software Engineer &
Development Team Lead
Computing and Analytics
Troy Zuroske
Software Engineer/Cloud Architect
Computing and Analytics
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
42
PNNL at a Glance
4,500
Employees
$987M
Budget
1,127
Publications
204
Inventions
64
Patents
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
43
Agenda
• Streaming deep learning image analysis pipeline
• Deploying models with Docker
• Reproducible deploys of GPU-enabled deep learning models
• Infrastructure as Code
• Automation for deploying complex serverless architecture
• Multi-account CI/CD
• Quick deploys and tight feedback for rapid development
• Questions?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
44
Streaming Deep Learning Image Analysis Pipeline
• Goal: Enable users to find relevant imagery
• Models: Junk filtering, avoid unnecessary
labeling, easily add new models
• Scale: 100+ images/sec
• Near real-time: <60 seconds end-to-end
NSFW Crowds
ImageNet
Indoor/Outdoor
Geolocation
NSFW?
Indoor?
Image Labels
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
45
Reactive, Message-Driven Architecture
How?
 Amazon Simple Queue Service
(Amazon SQS) and AWS Lambda
 Amazon DynamoDB for state
 Pipeline Lambda for orchestration logic
Why?
 Robust – stands up to bursts of data
without falling over
 Reliable – tolerates failures
 Scalable – scale up and down based
on streaming input
 Maintainable – easy to evolve
individual components
Images
Model
Pipeline Lambda
Model Model Model
Amazon DynamoDB
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
46
Deep Learning Models with Docker
Primary goal: Reproducible deploys on GPUs
 Today, tomorrow, next year
Docker GPU stack
 Application code and model
 Tensorflow-GPU and other Python packages
 NVIDIA Docker container
 NVIDIA Docker
 AWS Deep Learning AMI
Capture version dependencies
 Python packages
 System packages
 AMI
 The CUDA driver on the host must newer or equal to Docker container!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
47
Deep Learning Models - Deployment
AWS Lambda?
 Some models and libraries don’t fit in
available storage space
 GPUs are faster and more cost-
effective (efficient)
Amazon SageMaker?
 Supports REST API, but we needed
Amazon SQS workers
AWS Fargate?
 Ideal solution, but no GPU support
Amazon ECS?
 Complex auto-scaling: Two levels –
EC2 cluster and ECS service, Lambda
helper
 Slow auto-scaling: 20 minutes from
command to running worker
Amazon EC2 ✅
 Full control of instance/GPU type
 Simpler, faster auto-scaling than ECS
 Autoscaling based on queue length
(scale out) and worker utilization
(scale in)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
48
Infrastructure as Code (IaC)
• Capture AWS resources as code
 Machine readable, under revision control
• Required with Reactive, Serverless
 Our architecture has over 100 AWS resources
– manual is not an option
 Reproducibility, fewer errors, less time
 Enables continuous deployments (CD)
• AWS CloudFormation
 Alternative: Terraform
 Future: AWS CDK – program infrastructure in a real programming language
• IAM roles
• VPC and subnets
• Lambda functions
• Amazon SNS topics
• Amazon SQS
queues
• Amazon S3 buckets
• DynamoDB tables
• CloudWatch
Dashboards
• CloudWatch log
Groups
• CloudWatch alarms
• Autoscaling groups
• Autoscaling policies
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
49
AWS CloudFormation Lessons Learned
Capture everything required to deploy application from scratch
 Use conditions if necessary
Give every developer their own stack
 Use the username in the identifiers for uniqueness
Use the linter to validate templates – cfn-lint
Use YAML instead of JSON
Use AWS SAM for serverless resources
Use nested stacks to reduce copy/paste
 Used extensively when working with Deep Learning models
Script the deploy
 Shell script + environment-specific config files
 $ ./deploy.sh development.cfg
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
50
Development Process
• Git feature branch workflow
• Pull requests for code review
• Automated tests for PR feedback
• Merges result in automated deploys to our test/staging environment
Developer
Creates Feature
Branch
Developer
Commits
Changes
Developer Creates
/ Updates Pull
Request
Code Reviewers
Inspect Changes
Developer
Merges Pull
Request
CI System
Builds and
Tests Software
CI System
Deploys to
Staging
CI System
Builds and
Tests Software
Developer
Pushes
Changes
PassPassFail
Feedback Approval
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
51
Dev
Alice
Production
Bob
Production
Registry
Registry
Alice Bob
Tools On Premises
Build
Deploy
Commit
Test/Staging
Test
Registry
Multi-Developer and Multi-Account CI/CD Pipeline
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
52
CI/CD
Model Repo Lambda Repo
Model Build Lambda Build
Deploy
• Repos
 Model repo stores models and service wrappers
 Lambda repo has lambda code and AWS CloudFormation
• Builds
 Model build produces Docker images for each of the
models, and an inventory of all the image tags
 Lambda build runs linter, unit tests and produces a
software package for deploys
 Model build triggers lambda build
 Lambda build triggers deploy
• Deploy
 Create/update AWS CloudFormation stack
 Pull/push and retag images
 Deploy new images
Model Image Lambda Package
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
53
CI/CD for Docker-ized Models
Models and wrapper code are packaged as Docker images
Images stored in Amazon ECR
Image tagging
 Images tagged with build number during builds
 Images retagged with environment name during deploys
Cross account Amazon ECR permissions to move images between accounts
Amazon ECR policies to delete old/unused images
 Keep images from last N builds
 Keep images tagged for an environment: ‘development,’ ‘test,’ ‘production’
 Delete untagged images
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
54
Conclusions
• Capture all dependencies as code
 requirements.txt
 Dockerfiles
 AWS CloudFormation templates
 Scripts
 Config files
• Automate everything
 Build, test, deploy
 Reduce mistakes, iterate faster, improve reproducibility
• Previous two steps are building blocks for CI/CD
 Reproducible builds/deploys
 Easily deploy into different stacks/environments (developer, test, stage, prod, etc.)
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
55
Thank you!
Cindy Hewitt
Len Henry
• Gideon Juve
• Bill Vilwock
• Jordan Hendry
• Mike Giardinelli
• Ralph Perko
Thank you!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R
S U M M I T

Más contenido relacionado

La actualidad más candente

클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018
클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018 클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018
클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018
Amazon Web Services Korea
 

La actualidad más candente (20)

DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
Fundamentals of AWS Security
Fundamentals of AWS SecurityFundamentals of AWS Security
Fundamentals of AWS Security
 
Enterprise workloads on AWS
Enterprise workloads on AWSEnterprise workloads on AWS
Enterprise workloads on AWS
 
AWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipelineAWS CodeCommit, CodeDeploy & CodePipeline
AWS CodeCommit, CodeDeploy & CodePipeline
 
Are you Well Architected?
Are you Well Architected?Are you Well Architected?
Are you Well Architected?
 
AWS Technical Essentials Day
AWS Technical Essentials DayAWS Technical Essentials Day
AWS Technical Essentials Day
 
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
 
[NEW LAUNCH!] Introduction to AWS Global Accelerator (NET330) - AWS re:Invent...
[NEW LAUNCH!] Introduction to AWS Global Accelerator (NET330) - AWS re:Invent...[NEW LAUNCH!] Introduction to AWS Global Accelerator (NET330) - AWS re:Invent...
[NEW LAUNCH!] Introduction to AWS Global Accelerator (NET330) - AWS re:Invent...
 
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
Amazon GuardDuty: Intelligent Threat Detection and Continuous Monitoring to P...
 
금융 분야 마이데이터 (My Data) 산업 도입 방안 및 AWS 활용법 – 고종원 AWS 어카운트 매니저, 양찬욱 KB국민카드 팀장:: ...
금융 분야 마이데이터 (My Data) 산업 도입 방안 및 AWS 활용법 – 고종원 AWS 어카운트 매니저, 양찬욱 KB국민카드 팀장:: ...금융 분야 마이데이터 (My Data) 산업 도입 방안 및 AWS 활용법 – 고종원 AWS 어카운트 매니저, 양찬욱 KB국민카드 팀장:: ...
금융 분야 마이데이터 (My Data) 산업 도입 방안 및 AWS 활용법 – 고종원 AWS 어카운트 매니저, 양찬욱 KB국민카드 팀장:: ...
 
CI/CD for Modern Applications
CI/CD for Modern ApplicationsCI/CD for Modern Applications
CI/CD for Modern Applications
 
Cost optimization on AWS
Cost optimization on AWSCost optimization on AWS
Cost optimization on AWS
 
Introducing AWS Fargate
Introducing AWS FargateIntroducing AWS Fargate
Introducing AWS Fargate
 
Intro to AWS: Security
Intro to AWS: SecurityIntro to AWS: Security
Intro to AWS: Security
 
Accelerate Your Cloud Migration Journey.pdf
Accelerate Your Cloud Migration Journey.pdfAccelerate Your Cloud Migration Journey.pdf
Accelerate Your Cloud Migration Journey.pdf
 
APN-Funding-Progarm
APN-Funding-ProgarmAPN-Funding-Progarm
APN-Funding-Progarm
 
클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018
클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018 클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018
클라우드로 데이터 센터 확장하기 : 하이브리드 환경을 위한 연결 옵션 및 고려사항::강동환::AWS Summit Seoul 2018
 
Cloud Migration Workshop
Cloud Migration WorkshopCloud Migration Workshop
Cloud Migration Workshop
 
Introduction to Amazon EKS
Introduction to Amazon EKSIntroduction to Amazon EKS
Introduction to Amazon EKS
 
HelloCloud.io - Introduction to IaC & Terraform
HelloCloud.io - Introduction to IaC & TerraformHelloCloud.io - Introduction to IaC & Terraform
HelloCloud.io - Introduction to IaC & Terraform
 

Similar a CI/CD for Containers: A Way Forward for Your DevOps Pipeline

DevOps - Moving to DevOps the Amazon Way
DevOps - Moving to DevOps the Amazon WayDevOps - Moving to DevOps the Amazon Way
DevOps - Moving to DevOps the Amazon Way
Amazon Web Services
 

Similar a CI/CD for Containers: A Way Forward for Your DevOps Pipeline (20)

CI/CD best practices for building modern applications - MAD310 - New York AWS...
CI/CD best practices for building modern applications - MAD310 - New York AWS...CI/CD best practices for building modern applications - MAD310 - New York AWS...
CI/CD best practices for building modern applications - MAD310 - New York AWS...
 
Continuous Integration and Continuous Delivery Best Practices for Building Mo...
Continuous Integration and Continuous Delivery Best Practices for Building Mo...Continuous Integration and Continuous Delivery Best Practices for Building Mo...
Continuous Integration and Continuous Delivery Best Practices for Building Mo...
 
CI/CD best practices for building modern applications - MAD301 - Santa Clara ...
CI/CD best practices for building modern applications - MAD301 - Santa Clara ...CI/CD best practices for building modern applications - MAD301 - Santa Clara ...
CI/CD best practices for building modern applications - MAD301 - Santa Clara ...
 
CI/CD best practices for building modern applications - MAD302 - Atlanta AWS ...
CI/CD best practices for building modern applications - MAD302 - Atlanta AWS ...CI/CD best practices for building modern applications - MAD302 - Atlanta AWS ...
CI/CD best practices for building modern applications - MAD302 - Atlanta AWS ...
 
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
CI/CD Best Practices for Building Modern Applications - MAD302 - Anaheim AWS ...
 
CICDforModernApplications_Stockholm.pdf
CICDforModernApplications_Stockholm.pdfCICDforModernApplications_Stockholm.pdf
CICDforModernApplications_Stockholm.pdf
 
DevOps Spain 2019. Pedro Mendoza-AWS
DevOps Spain 2019. Pedro Mendoza-AWSDevOps Spain 2019. Pedro Mendoza-AWS
DevOps Spain 2019. Pedro Mendoza-AWS
 
AWS DevDay Cologne - CI/CD for modern applications
AWS DevDay Cologne - CI/CD for modern applicationsAWS DevDay Cologne - CI/CD for modern applications
AWS DevDay Cologne - CI/CD for modern applications
 
Making CI/CD pipelines safer with application monitoring and tracing - MAD202...
Making CI/CD pipelines safer with application monitoring and tracing - MAD202...Making CI/CD pipelines safer with application monitoring and tracing - MAD202...
Making CI/CD pipelines safer with application monitoring and tracing - MAD202...
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
 
AWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the CloudAWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the Cloud
 
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
 
AWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the CloudAWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the Cloud
 
CI/CD for Serverless and Containerized Applications (DEV309-R1) - AWS re:Inve...
CI/CD for Serverless and Containerized Applications (DEV309-R1) - AWS re:Inve...CI/CD for Serverless and Containerized Applications (DEV309-R1) - AWS re:Inve...
CI/CD for Serverless and Containerized Applications (DEV309-R1) - AWS re:Inve...
 
DevOps - Moving to DevOps the Amazon Way
DevOps - Moving to DevOps the Amazon WayDevOps - Moving to DevOps the Amazon Way
DevOps - Moving to DevOps the Amazon Way
 
A Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer Tools
A Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer ToolsA Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer Tools
A Tale of Two Pizzas: Accelerating Software Delivery with AWS Developer Tools
 
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
CI CD using AWS Developer Tools @ AWS Community Day Chennai 2019
 
Improve Productivity with Continuous Integration & Delivery
Improve Productivity with Continuous Integration & DeliveryImprove Productivity with Continuous Integration & Delivery
Improve Productivity with Continuous Integration & Delivery
 
Improve productivity with Continuous Integration & Delivery
Improve productivity with Continuous Integration & DeliveryImprove productivity with Continuous Integration & Delivery
Improve productivity with Continuous Integration & Delivery
 
From Monolith to Microservices
From Monolith to MicroservicesFrom Monolith to Microservices
From Monolith to Microservices
 

Más 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
 

Más 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
 

CI/CD for Containers: A Way Forward for Your DevOps Pipeline

  • 1. P U B L I C S E C T O R S U M M I T WASHINGTON, DC
  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T CI/CD for Serverless and Containerized Applications Len Henry Senior Solutions Architect AWS/WWPS Education 3 0 1 5 9 4 Justin Almquist Senior Software Engineer & Development Team Lead Computing and Analytics Troy Zuroske Software Engineer/Cloud Architect Computing and Analytics
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Agenda CI/CD for modern applications Continuous integration Continuous deployment Infrastructure as code CI/CD for a Real-Time Deep Learning Pipeline
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T What is a modern application?
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Approaches to modern application development • Simplify environment management • Reduce the impact of code changes • Automate operations • Accelerate the delivery of services • Gain insight across resources and applications • Protect customers and the business
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Approaches to modern application development • Simplify environment management with serverless technologies • Reduce the impact of code changes with microservice architectures • Automate operations by modeling applications & infrastructure as code • Accelerate the delivery of services with CI/CD • Gain insight across resources and applications by enabling observability • Protect customers and the business with end-to-end security & compliance
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Approaches to modern application development • Simplify environment management with serverless technologies • Reduce the impact of code changes with microservice architectures • Automate operations by modeling applications & infrastructure as code • Accelerate the delivery of services with CI/CD • Gain insight across resources and applications by enabling observability • Protect customers and the business with end-to-end security & compliance
  • 8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Approaches to modern application development Serverless containers Long-running Abstracts the OS Fully managed orchestration Fully managed cluster scaling Serverless functions Event-driven Many language runtimes Data source integrations No server management
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Approaches to modern application development • Simplify environment management with serverless technologies • Reduce the impact of code changes with microservice architectures • Automate operations by modeling applications & infrastructure as code • Accelerate the delivery of services with CI/CD • Gain insight across resources and applications by enabling observability • Protect customers and the business with end-to-end security & compliance
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Release process stages Source Build Test Production
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Release process stages Source Build Test Production • Integration tests with other systems • Load testing • UI tests • Security testing • Check-in source code such as .java files • Peer review new code • Compile code • Unit tests • Style checkers • Create container images and function deployment packages • Deployment to production environments • Monitor code in production to quickly detect errors
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Effects of CI/CD Source: 2018 DORA State of DevOps Report Deployment frequency Weekly – monthly Hourly – daily Change lead time One – six months One – seven days Change failure rate 46-60% 0-15%
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Pillars of releasing modern applications
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Pillars of releasing modern applications Continuous integration
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Continuous integration goals Source Build Test Production
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Continuous integration goals 1. Automatically kick off a new release when new code is checked in 2. Build and test code in a consistent, repeatable environment 3. Continually have an artifact ready for deployment 4. Continually close feedback loop when build fails
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T AWS CodePipeline • Continuous delivery service for fast and reliable application updates • Model and visualize your software release process • Builds, tests, and deploys your code every time there is a code change • Integrates with third-party tools and AWS
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T AWS CodePipeline: Supported sources Pick branch AWS CodeCommit GitHub Pick object or folder Amazon Simple Storage Service (Amazon S3) Pick Docker tag Amazon Elastic Container Registry (Amazon ECR) Automatically kick off release and pull latest source code
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T AWS CodeBuild • Fully managed build service that compiles source code, runs tests, and produces software packages • Scales continuously and processes multiple builds concurrently • No build servers to manage • Pay by the minute, only for the compute resources you use • Monitor builds through Amazon CloudWatch Events
  • 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T AWS CodeBuild • Each build runs in a new Docker container for a consistent, immutable environment • Docker and AWS Command Line Interface (AWS CLI) are installed in every official CodeBuild image • Provide custom build environments suited to your needs through the use of Docker images
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Pillars of releasing modern applications Continuous deployment Continuous integration
  • 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Continuous deployment goals Source Build Test Production
  • 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Continuous deployment goals 1. Automatically deploy new changes to staging environments for testing 2. Deploy to production safely without impacting customers 3. Deliver to customers faster: Increase deployment frequency and reduce change lead time and change failure rate
  • 24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T AWS CodeDeploy • Automates code deployments to any instance and AWS Lambda • Handles the complexity of updating your applications • Avoids downtime during application deployment • Rolls back automatically if failure detected • Deploys to Amazon Elastic Compute Cloud (Amazon EC2), Lambda, or on-premises servers
  • 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T CodeDeploy-Lambda deployments • Shifts traffic using Lambda function weighted aliases • Choose canary (“shift 10% of traffic for 10 minutes, then shift rest”) or linear (“shift 10% more traffic every 10 minutes”) • Validation “hooks” enable testing at each stage of the deployment • Fast rollback in seconds if case of hook failure or CloudWatch alarms • Monitor deployment status and history via console, API, Amazon Simple Notification Service (Amazon SNS) notifications, and CloudWatch Events
  • 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T AWS CodeDeploy AWS CodeDeploy now automates blue-green deployments to AWS Fargate and Amazon Elastic Container Service (Amazon ECS)
  • 27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Container image tagging for deployments • Docker tags are resolved when each container starts, not just during deployments • Deploying “latest” or “prod” can result in untested code in production after a scale-out event • Use unique “immutable” tags for deployments
  • 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Pillars of releasing modern applications Infrastructure as code Continuous deployment Continuous integration
  • 29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Infrastructure as code goals Source Build Test Productio n
  • 30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Infrastructure as code goals 1. Make infrastructure changes repeatable and predictable 2. Release infrastructure changes using the same tools as code changes 3. Replicate production environment in a staging environment to enable continuous testing
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Continuous testing with infrastructure as code Validate an artifact (Build stage) • Unit tests • Static analysis • Mocked dependencies and environments • Vulnerability image scans Validate an environment (Test stages) • Integration tests against real dependencies and real environments • Load testing • Penetration testing • Monitoring to test impact of deployments on environment
  • 32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Release infrastructure-as-code “Master” branch Prepare template Create & execute change set Create & execute change set
  • 33. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Model function environments with AWS Serverless Application Model (SAM) https://aws.amazon.com/serverless/sam/ • Open source framework for building serverless applications on AWS • Shorthand syntax to express functions, APIs, databases, and event source mappings • Transforms and expands SAM syntax into AWS CloudFormation syntax on deployment • Supports all AWS CloudFormation resource types
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Model container environments with AWS Cloud Development Kit (CDK) • Open source framework to define cloud infrastructure in Typescript • Provides library of higher-level resource types (“construct” classes) that have AWS best practices built in by default, packaged as npm modules • Provisions resources with AWS CloudFormation • Supports all AWS CloudFormation resource types AWS CDK https://awslabs.github.io/aws-cdk
  • 35. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T CDK template import ec2 = require('@aws-cdk/aws-ec2'); import ecs = require('@aws-cdk/aws-ecs'); import cdk = require('@aws-cdk/cdk'); class BonjourFargate extends cdk.Stack { constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { super(parent, name, props); const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); new ecs.LoadBalancedFargateService( this, "FargateService", { cluster, image: ecs.DockerHub.image("amazon/amazon-ecs-sample"), }); } } const app = new cdk.App(); new BonjourFargate(app, 'Bonjour'); app.run();
  • 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T CDK template import ec2 = require('@aws-cdk/aws-ec2'); import ecs = require('@aws-cdk/aws-ecs'); import cdk = require('@aws-cdk/cdk'); class BonjourFargate extends cdk.Stack { constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { super(parent, name, props); const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); new ecs.LoadBalancedFargateService( this, "FargateService", { cluster, image: ecs.DockerHub.image("amazon/amazon-ecs-sample"), }); } } const app = new cdk.App(); new BonjourFargate(app, 'Bonjour'); app.run();
  • 37. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T CDK template import ec2 = require('@aws-cdk/aws-ec2'); import ecs = require('@aws-cdk/aws-ecs'); import cdk = require('@aws-cdk/cdk'); class BonjourFargate extends cdk.Stack { constructor(parent: cdk.App, name: string, props?: cdk.StackProps) { super(parent, name, props); const vpc = new ec2.VpcNetwork(this, 'MyVpc', { maxAZs: 2 }); const cluster = new ecs.Cluster(this, 'Cluster', { vpc }); new ecs.LoadBalancedFargateService( this, "FargateService", { cluster, image: ecs.DockerHub.image("amazon/amazon-ecs-sample"), }); } } const app = new cdk.App(); new BonjourFargate(app, 'Bonjour'); app.run();
  • 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Model pipelines with AWS CDK • Minimize copy-and-paste by using object-oriented language • Define microservice pipeline “shape” in one class, then re-use it across many pipelines • AWS CDK includes many high-level constructs for modeling a CodePipeline pipeline, including automatically configuring AWS Identity and Access Management (IAM) role policies
  • 39. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Pillars of releasing modern applications Infrastructure as code Continuous deployment Continuous integration
  • 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T Draft CI/CD for a Real-Time Deep Learning Pipeline Justin Almquist, Senior Software Engineer PNNL Troy Zuroske, Software Engineer PNNL June 19, 2019
  • 41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 41 Introductions Justin Almquist Senior Software Engineer & Development Team Lead Computing and Analytics Troy Zuroske Software Engineer/Cloud Architect Computing and Analytics © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 42 PNNL at a Glance 4,500 Employees $987M Budget 1,127 Publications 204 Inventions 64 Patents © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 43 Agenda • Streaming deep learning image analysis pipeline • Deploying models with Docker • Reproducible deploys of GPU-enabled deep learning models • Infrastructure as Code • Automation for deploying complex serverless architecture • Multi-account CI/CD • Quick deploys and tight feedback for rapid development • Questions? © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 44 Streaming Deep Learning Image Analysis Pipeline • Goal: Enable users to find relevant imagery • Models: Junk filtering, avoid unnecessary labeling, easily add new models • Scale: 100+ images/sec • Near real-time: <60 seconds end-to-end NSFW Crowds ImageNet Indoor/Outdoor Geolocation NSFW? Indoor? Image Labels © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 45 Reactive, Message-Driven Architecture How?  Amazon Simple Queue Service (Amazon SQS) and AWS Lambda  Amazon DynamoDB for state  Pipeline Lambda for orchestration logic Why?  Robust – stands up to bursts of data without falling over  Reliable – tolerates failures  Scalable – scale up and down based on streaming input  Maintainable – easy to evolve individual components Images Model Pipeline Lambda Model Model Model Amazon DynamoDB © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 46. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 46 Deep Learning Models with Docker Primary goal: Reproducible deploys on GPUs  Today, tomorrow, next year Docker GPU stack  Application code and model  Tensorflow-GPU and other Python packages  NVIDIA Docker container  NVIDIA Docker  AWS Deep Learning AMI Capture version dependencies  Python packages  System packages  AMI  The CUDA driver on the host must newer or equal to Docker container! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 47. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 47 Deep Learning Models - Deployment AWS Lambda?  Some models and libraries don’t fit in available storage space  GPUs are faster and more cost- effective (efficient) Amazon SageMaker?  Supports REST API, but we needed Amazon SQS workers AWS Fargate?  Ideal solution, but no GPU support Amazon ECS?  Complex auto-scaling: Two levels – EC2 cluster and ECS service, Lambda helper  Slow auto-scaling: 20 minutes from command to running worker Amazon EC2 ✅  Full control of instance/GPU type  Simpler, faster auto-scaling than ECS  Autoscaling based on queue length (scale out) and worker utilization (scale in)
  • 48. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 48 Infrastructure as Code (IaC) • Capture AWS resources as code  Machine readable, under revision control • Required with Reactive, Serverless  Our architecture has over 100 AWS resources – manual is not an option  Reproducibility, fewer errors, less time  Enables continuous deployments (CD) • AWS CloudFormation  Alternative: Terraform  Future: AWS CDK – program infrastructure in a real programming language • IAM roles • VPC and subnets • Lambda functions • Amazon SNS topics • Amazon SQS queues • Amazon S3 buckets • DynamoDB tables • CloudWatch Dashboards • CloudWatch log Groups • CloudWatch alarms • Autoscaling groups • Autoscaling policies © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 49. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 49 AWS CloudFormation Lessons Learned Capture everything required to deploy application from scratch  Use conditions if necessary Give every developer their own stack  Use the username in the identifiers for uniqueness Use the linter to validate templates – cfn-lint Use YAML instead of JSON Use AWS SAM for serverless resources Use nested stacks to reduce copy/paste  Used extensively when working with Deep Learning models Script the deploy  Shell script + environment-specific config files  $ ./deploy.sh development.cfg
  • 50. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 50 Development Process • Git feature branch workflow • Pull requests for code review • Automated tests for PR feedback • Merges result in automated deploys to our test/staging environment Developer Creates Feature Branch Developer Commits Changes Developer Creates / Updates Pull Request Code Reviewers Inspect Changes Developer Merges Pull Request CI System Builds and Tests Software CI System Deploys to Staging CI System Builds and Tests Software Developer Pushes Changes PassPassFail Feedback Approval
  • 51. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 51 Dev Alice Production Bob Production Registry Registry Alice Bob Tools On Premises Build Deploy Commit Test/Staging Test Registry Multi-Developer and Multi-Account CI/CD Pipeline
  • 52. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 52 CI/CD Model Repo Lambda Repo Model Build Lambda Build Deploy • Repos  Model repo stores models and service wrappers  Lambda repo has lambda code and AWS CloudFormation • Builds  Model build produces Docker images for each of the models, and an inventory of all the image tags  Lambda build runs linter, unit tests and produces a software package for deploys  Model build triggers lambda build  Lambda build triggers deploy • Deploy  Create/update AWS CloudFormation stack  Pull/push and retag images  Deploy new images Model Image Lambda Package © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 53. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 53 CI/CD for Docker-ized Models Models and wrapper code are packaged as Docker images Images stored in Amazon ECR Image tagging  Images tagged with build number during builds  Images retagged with environment name during deploys Cross account Amazon ECR permissions to move images between accounts Amazon ECR policies to delete old/unused images  Keep images from last N builds  Keep images tagged for an environment: ‘development,’ ‘test,’ ‘production’  Delete untagged images
  • 54. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 54 Conclusions • Capture all dependencies as code  requirements.txt  Dockerfiles  AWS CloudFormation templates  Scripts  Config files • Automate everything  Build, test, deploy  Reduce mistakes, iterate faster, improve reproducibility • Previous two steps are building blocks for CI/CD  Reproducible builds/deploys  Easily deploy into different stacks/environments (developer, test, stage, prod, etc.)
  • 55. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T 55 Thank you! Cindy Hewitt Len Henry • Gideon Juve • Bill Vilwock • Jordan Hendry • Mike Giardinelli • Ralph Perko
  • 56. Thank you! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T
  • 57. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.P U B L I C S E C T O R S U M M I T