Today’s cutting edge companies have software release cycles measured in days instead of months. This agility is enabled by the DevOps practice of continuous delivery, which automates building, testing, and deploying all code changes. This automation helps you catch bugs sooner and accelerates developer productivity. In this session, we’ll share the processes followed by Amazon engineers and discuss how you can bring them to your company by using AWS CodePipeline and AWS CodeDeploy, services inspired by Amazon's internal developer tools and DevOps culture.
2. What to expect in this session :
Evolution of DevOps
What is DevOps?
AWS Tools for Accelerated software delivery
using CI/CD and Infrastructure as Code
DEV OPS
3. Software moves faster today
Software creation and distribution is
easier and faster than ever:
• Startups can now take on giants with little to
no funding ahead of time
• Getting your software into the hands of
millions is a download away
• Your ability to move fast is paramount to your
ability to fight off disruption
5. Agile
- Iterative development
- Sprints, Stories, Feedback
- Velocity
Agile Software Development
Business
Agility
Business
Case
Requirements Use Case Features Plan Go to Market
Design Code Refactor Unit Test Bug Fix Deploy
Provision Configure Orchestrate Deploy Report Monitor
Business
Developers
(application)
IT operations
(infrastructure)
7. DevOps
- IT Automation
- Continuous Integration
- Continuous Deployment
Co-evolution of Agile and DevOps software development
IT
Agility
Business
Agility
Agile
- Iterative development
- Sprints, Stories, Feedback
- Velocity
Business
Case
Requirements Use Case Features Plan Go to Market
Design Code Refactor Unit Test Bug Fix Deploy
Provision Configure Orchestrate Deploy Report Monitor
Business
Developers
(application)
IT operations
(infrastructure)
10. • code building,
• code coverage,
• unit testing,
• packaging, and
• deployment
DevOps Practices vary with task
• provisioning,
• configuration,
• orchestration, and
• deployment
Application Development Infrastructure Management
Version Management Deployment
Roll Forward TestingRoll Back
underlying principles remain the same :
11. DevOps tools stack on AWS
Source Build Test Deploy Provision Monitor
CodeCommit CodeBuild
CodeDeploy
CodePipeline
Cloud
Formation
Cloud
Watch
Elastic Beanstalk
OpsWorks
EC2 Container Service (ECS)
X-ray
12. Availability Zone BAvailability Zone A
RDS instance
standby
(Multi-AZ)
Public subnet
EC2 instances
security group
Web Server
With Multi-AZ
Autoscaling
Public subnet
RDS DB
instance
Private subnetPrivate subnet
Synchronous
replication
EC2 instances
Elastic Load
Balancing
Auto Scaling
Region
v1 v1
15. • Integration
tests with
other systems
• Load testing
• UI tests
• Penetration
testing
Release processes have four major phases
Source Build Test Production
• Check-in
source code
• Peer review
new code
• Version
control
• Compile code
• Unit tests
• Style checkers
• Code metrics
• Create
container
images
• Deployment
to production
environments
18. AWS CodeCommit
Secure, scalable, and managed Git source control
Use standard Git tools
No repository size limit
Scalability, availability, and durability of Amazon S3
Post commit hooks to call out to AWS Lambda/ Amazon
Simple Notification Service(SNS)
Encryption at rest with customer-specific keys
19.
20.
21. AWS CodeBuild
Fully managed build service that compiles source code,
runs test, and produces software packages
Scales continuously and processes multiple builds
concurrently
You can provide custom build environments suited to
your needs via Docker images
Only pay by the minute for the compute resources you
use
23. version: 0.1
environment_variables:
plaintext:
JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64”
phases:
build:
commands:
- echo Build started
- mvn test
post_build:
commands:
- echo Build completed
- mvn package
artifacts:
files:
- target/my-web-app.war
Set a custom environment
variable with the key
of JAVA_HOME
You cannot change these build
phase names.
echo commands do not run,
are to display of phases and
their order of execution
Represents the files to
upload to the build output
location.
Sample buildspec.yml
24. Testing your code
Testing is both a science and an art form!
Goals for testing your code:
• Confirm desired functionality
• Catch programming syntax errors
• Standardize code patterns and format
• Reduce bugs due to non-desired application usage and
logic failures
• Make applications more secure
25. Service and release phase corresponding to test
UI
Service
Unit
BuildTest
AWS
CodeBuild
Third-party
tooling
26.
27. AWS CodeDeploy
Automates code deployments to any instance
• In-place
• Green-Blue
Handles the complexity of updating your applications
Avoid downtime during application deployment
Rollback automatically if failure detected
Deploy to Amazon EC2 or on-premises servers, in any
language and on any operating system
Integrates with third-party tools and AWS
28. Application Specification Files
“appspec.yml”
• Defines lifecycle event hooks that allow you
to run scripts on an instance,
• In YAML format,
• CodeDeploy Agent running on EC2 instances
execute the scripts specified in this file
29. Sample appspec.yml
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html
permissions:
- object: /var/www/html
pattern: “*.html”
owner: root
group: root
mode: 755
hooks:
ApplicationStop:
- location: scripts/deregister_from_elb.sh
BeforeInstall:
- location: scripts/install_dependencies.sh
ApplicationStart:
- location: scripts/start_httpd.sh
ValidateService:
- location: scripts/test_site.sh
- location: scripts/register_with_elb.sh
• Remove/add instance to ELB
• Install dependency packages
• Start Apache
• Confirm successful deploy
• More!
Send application files to one
directory and configuration files to
another
Set specific permissions on
specific directories and files
30.
31. We have a strong partner list, and it’s growing
34. 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
Supports manual approvals
Integrates with other AWS services and third-party tools
42. Create templates of your infrastructure
Write templates in JSON or YAML
CloudFormation provisions AWS resources
based on dependency needs
Version control/replicate/update templates like
code
Integrates with development, CI/CD,
management tools
AWS CloudFormation
43. • JSON/YAML format template
• Presents template to CloudFormation Service
• CloudFormation translates that to API request
• Forms a stack of resources
• FREE – only pay for resources
• All regions
• API are called in parallel
• Manages dependencies/relationships
API calls made on
your behalf
Template
A running
environment
Stack
Components & Technology
Framework
44. Infrastructure as Code
• Network, Servers, Storage etc.
are just part of your service.
• Single source of truth to deploy
the whole stack.
• Infrastructure that you can
replicate, re-deploy, re-purpose
• Version control your
infrastructure and your
application together.
• Build your infrastructure and
run it through your CI/CD
pipeline.
Template
Development Stack
Staging Stack
Production Stack
code
version
control
code
review
integrate
“It’s all software”
48. Code* tips and tricks
• All Code* products can (and should) be provisioned and managed
with AWS CloudFormation!
• (It’s like Code* inception!)
• Deep integration with AWS IAM. You can assign permissions on
who can commit code, approve manual approvals, deploy to certain
deployment groups, and more!
• Integrate with AWS Lambda to do almost anything:
• CodeCommit has Repository Triggers
• CodeDeploy has Event Notifications
• CodePipeline has native Lambda invoke
49. General best practices used by Amazon developers
• CI/CD is a MUST!
• Commit frequently
• Builds on every commit
• Build once in a given execution flow
• Deploy to a running environment for further testing
• Everything that is code (application, infrastructure, documentation)
goes into a repository
• Start with continuous delivery (“gated” promotion) and build up to
continuous deployment once evidence of a high-level of excellence in
testing is clear
50. Next Steps
• AWS Free Tier - start today!
• AWS for DevOps Walkthrough documentation -
https://docs.aws.amazon.com/devops/latest/gsg/welcome.html
• Watch Re:invent DEV403 DevOps on AWS-Advanced
Continuous Delivery