More Related Content More from Amazon Web Services (20) DevOps On AWS: Advanced Techniques for Amazon EC2 Deployments on AWS1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
DevOps On AWS:
Advanced Techniques for Amazon EC2
Deployments on AWS
Balaji Iyer
Infrastructure Architect
AWS Professional Services
2. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
What we'll cover
• What is Continuous Deployment?
• Deployment Approaches
• Blue-Green Deployment
• Red-Black Deployment
• Continuous Delivery Machine
3. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Continuous Delivery
(CD) is the extension of CI where teams ensure that every change to the
system is releasable and production ready, and that we can release any
version at the push of a button. Continuous Delivery aims to make releases
boring, so we can deliver frequently and get fast feedback on what end
users care about.
http://www.thoughtworks.com/continuous-delivery
4. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Continuous Delivery
Version
Control
CI Server
Package
Builder
Deploy
ServerCommit to
Git/master
Dev
Get /
Pull
Code
AMIs
Send Build Report to Dev
Stop everything if build failed
Distributed Builds
Run Tests in parallel
Staging Env
Test Env
Code
Config
Tests
Prod Env
Push
Config
Install
Create
Repo
CloudFormation
Templates for Env
Generate
5. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
• Automated, repeatable process to push changes to production
• Hardens, de-risks the deployment process
• Allows detection of failure as quickly as possible in the build process
• Supports A/B testing or “We test customer reactions to features in
production”
• Gives us a breadth of data points across our applications
What Does CD Give Us?
6. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Automated Testing
• Robust, automated testing drives confidence in the entire process
• Testing is not viewed as a “phase” of a project
- Testing starts on day one
• View failures as successes
• Don’t overlook testing the infrastructure
- Are you ready for the Simian Army?
• Testing is everyone’s responsibility
7. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Continuous Deployment
The ultimate culmination of this process; it is the actual delivery of features
and fixes to the customer as soon as they are ready. Essentially the release
of every commit directly to production as soon as possible. This provides the
maximum value to customers in that features are released as soon as they
are ready, and with the confidence that they have been tested thoroughly.
http://blogs.atlassian.com/2014/04/practical-continuous-deployment/
8. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Continuous Deployment
9. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Approaches
• Deploy in-place
- Deploy all at once (Service outage)
- Rolling updates
Demo
10. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Approaches
• Blue-Green Deployment
– Discrete environment
– Multiple environments from branches
– Support A/B testing
– “Rolling DNS”
• Alternate Blue-Green (Red-Black?) Deployment
– Attach and detach Auto Scaling groups from Elastic Load balancers
– Avoid messing with DNS
11. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Blue-Green Deployment
• Stand up duplicate
infrastructure and slowly
cut traffic over to it
- Shift via DNS
- Simplifies feature testing
- Simplifies roll back
• As we shift more traffic
over, let auto-scaling
grow/shrink our instances
- Shut down the old when no traffic there
Amazon
Route 53
EC2 Instances
ELB
100%
DynamoDB
MySQL RDS
Instance
ElastiCache
Cache Node
12. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Blue-Green Deployment
• Stand up duplicate
infrastructure and slowly
cut traffic over to it
- Shift via DNS
- Simplifies feature testing
- Simplifies roll back
• As we shift more traffic
over, let auto-scaling
grow/shrink our instances
- Shut down the old when no traffic there
Amazon
Route 53
EC2 Instances
ELB
EC2 Instances
ELB
90% 10%
DynamoDB
MySQL RDS
Instance
ElastiCache
Cache Node
13. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Blue-Green Deployment
• Stand up duplicate
infrastructure and slowly
cut traffic over to it
- Shift via DNS
- Simplifies feature testing
- Simplifies roll back
• As we shift more traffic
over, let auto-scaling
grow/shrink our instances
- Shut down the old when no traffic there
Amazon
Route 53
EC2 Instances
ELB
EC2 Instances
ELB
0% 100%
DynamoDB MySQL RDS
Instance
ElastiCache
Cache Node
14. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Blue-Green Deployment
• Stand up duplicate
infrastructure and slowly
cut traffic over to it
- Shift via DNS
- Simplifies feature testing
- Simplifies roll back
• As we shift more traffic
over, let auto-scaling
grow/shrink our instances
- Shut down the old when no traffic there
Amazon
Route 53
EC2 Instances
ELB
EC2 Instances
ELB
0% 100%
DynamoDB MySQL RDS
Instance
ElastiCache
Cache Node
15. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
ASG V1
ELB
Red-Black Deployment
RDS
16. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
ELB
ASG V1 ASG V2
UAT
RDS
Red-Black Deployment
17. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
ELB
ASG V1 ASG V2
RDS
Red-Black Deployment
18. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
ELB
RDS
ASG V2
Red-Black Deployment
19. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Timeline
V2.1
ID NAME ADDRESS ORDERID (Char)
23234 Joe Doe xxx 333424
45322 Rob Smith xxxx 234
2342342 Jane Smith xxxx 23424
2342265 Anne Lee xxxx 2342425
Dealing with databases example
20. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Timeline
DB
V1.1
V2.1
ID NAME ADDRESS ORDERID ORDERID_INT
23234 Joe Doe xxx 333424
45322 Rob Smith xxxx 234
2342342 Jane Smith xxxx 23424
2342265 Anne Lee xxxx 2342425
Dealing with databases example
• Add a New Column
21. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Timeline
DB
V1.1
V2.1
ID NAME ADDRESS ORDERID ORDERID_INT
23234 Joe Doe xxx 333424
45322 Rob Smith xxxx 234
2342342 Jane Smith xxxx 23424
2342265 Anne Lee xxxx 2342425
3632342 Mark Fox cxxxx 567890 567890
Dealing with databases example
• Add a New Column
• Change Apps to write to both new & old columns
22. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Timeline
DB
V1.1
V2.1
ID NAME ADDRESS ORDERID ORDERID_INT
23234 Joe Doe xxx 333424 333424
45322 Rob Smith xxxx 234 234
2342342 Jane Smith xxxx 23424 23424
2342265 Anne Lee xxxx 2342425 2342425
3632342 Mark Fox cxxxx 567890 567890
DB
V1.2
Dealing with databases example
• Add a New Column
• Change Apps to write to both new & old columns
• Migrate old column data to new column ( for older rows)
23. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Timeline
DB
V1.1
V2.1
ID NAME ADDRESS ORDERID ORDERID_INT
23234 Joe Doe xxx 333424 333424
45322 Rob Smith xxxx 234 234
2342342 Jane Smith xxxx 23424 23424
2342265 Anne Lee xxxx 2342425 2342425
3632342 Mark Fox cxxxx 567890 567890
DB
V1.2
V2.2
Dealing with databases example
• Add a New Column
• Change Apps to write to both new & old columns
• Migrate old column data to new column ( for older rows)
• Update all Apps to read from new column
24. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Timeline
DB
V1.1
V2.1
ID NAME ADDRESS ORDERID ORDERID_INT
23234 Joe Doe xxx 333424 333424
45322 Rob Smith xxxx 234 234
2342342 Jane Smith xxxx 23424 23424
2342265 Anne Lee xxxx 2342425 2342425
3632342 Mark Fox cxxxx 567890 567890
433453 Mark Lee cxxxxx 4352342422
DB
V1.2
V2.2 V2.3
Dealing with databases example
• Add a New Column
• Change Apps to write to both new & old
columns
• Migrate old column data to new column ( for
older rows)
• Update all Apps to read from new column
• Update all Apps to only write to new
column
25. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Deployment Timeline
DB
V1.1
V2.1
ID NAME ADDRESS ORDERID_INT
23234 Joe Doe xxx 333424
45322 Rob Smith xxxx 234
2342342 Jane Smith xxxx 23424
2342265 Anne Lee xxxx 2342425
3632342 Mark Fox cxxxx 567890
433453 Mark Lee cxxxxx 4352342422
DB
V1.2
V2.2 V2.3
DB
V1.3
Dealing with databases example
• Add a New Column
• Change Apps to write to both new & old
columns
• Migrate old column data to new column (
for older rows)
• Update all Apps to read from new column
• Update all Apps to only write to new
column
• Drop the old column
26. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
MonitorProvisionDeployTestBuildCode
Elastic Beanstalk
OpsWorks
Cloud
Watch
Cloud
Formation
Code
Deploy
Code
Commit
Code
Pipeline
AWS DevOps Aligned Services
27. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
EC2CloudFormationOpsWorksBeanstalk
Managed Deployment Do it Yourself
Convenience Control
28. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Build
CodeBuild
AWS CodeBuild
NotifyDevelopers
Lambda
TestAPI
Runscope
Sequential actions
Deploy
JavaApp
Elastic Beanstalk
Source
Source
GitHub
CodePipeline
MyApplication
29. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Build
CodeBuild
AWS CodeBuild
Staging-Deploy
JavaApp
Elastic Beanstalk
Prod-Deploy
JavaApp
Elastic Beanstalk
QATeamReview
Manual Approval
Manual Approvals
Review
CodePipeline
MyApplication
30. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Enabling Continuous Delivery
• Create repeatable patterns and standardized code elements that allow the
enablement of customizable parameterized deployment of entire stacks of
applications consistently to our specifications
• Build reliable shared services that enable quick adoption of repeatable patterns
for many diverse workloads and applications
• Provide a consistent set of coded artifacts that can serve to reduce the training,
documentation and ramp up costs across a large diverse development team
31. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Enabling Continuous Delivery
• The Continuous Delivery Machine
– Enables developers to use shared services and repeatable patterns to create
continuous delivery pipelines for their applications and workloads
• Continuous Delivery Pipeline
– A set of chained automation jobs constructed in phases that orchestrate the build,
deploy, test and monitoring of a set of applications or workloads
32. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Building a Continuous Delivery Machine
• Source Code Repository
• Continuous Integration System
• Infrastructure Provisioning System
• Configuration Management System
• Artifact Management System
• Cetralized Log Management System
• Monitoring and Feedback System
33. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Elements of a Continuous Delivery Pipeline
• Commit Phase
– Static code analysis
• Acceptance Phase
– Dynamic analysis
• Capacity Phase
– Load, performance and failover testing
• Exploratory Phase
– Penetration and experimental testing
• Production Phase
– Blue/Green Deployment
– Persistent data handling
34. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Automate Everything
• Automation is vital to smaller, more frequent releases
• All steps that add human intervention also add
fragility
- “Small compromises can undermine your success”
• Use knowledge gathered from frequent, automated
releases to constantly evolve the process
35. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
The Continuous Delivery Maturity Model
• Designed to allow for quick enablement of large teams to both create the
shared services required to enable Continuous Delivery as well as
development of application specific pipelines in concert
• Shared services are stood up just in time to allow application teams to
mature their pipeline development
• The Continuous Delivery System owners are 1 maturity level ahead of the
Pipeline owners
36. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
The Continuous Delivery Maturity Model
• Builds on Minimal Viable Product concepts to rapidly establish automated
deployment capability for many applications
• Enables large teams to start contributing quickly
• Creates functional systems layer that allows developers to quickly find
reusable patterns to apply to new workloads
• Allows visibility into how mature workloads are across the organization
• Can be measured to compare strategies for success
37. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
References
• Blue/Green Deployments on AWS Whitepaper:
– Overview, techniques, and best practices for implementing a Blue/Green deployment
strategy.
– https://d0.awsstatic.com/whitepapers/AWS_Blue_Green_Deployments.pdf
• CodeDeploy Tutorials:
– http://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials.html
• Walkthroughs:
– http://docs.aws.amazon.com/codedeploy/latest/userguide/tutorials-github.html
• Workflows:
– http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-steps.html
38. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
THANK YOU
39. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved
?
https://secure.flickr.com/photos/dullhunk/202872717/