Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Bob Griffiths, Solutions Architect Manager
September 21st 2016
Infrastructure as Code
Introduction to Best Practices on AWS
Learning Objectives
• Choosing the right EC2 instances
• Infrastructure as code
• AWS services that help you manage your infrastructure
as code
• Best practices for managing your AWS infrastructure,
host configuration, and applications
Choosing the Right Amazon EC2 Instance
EC2 Instance types are optimized for different use cases & come in
multiple sizes. This allows you to optimally scale resources to your
workload requirements.
AWS utilizes Intel® Xeon® processors for EC2 Instances providing
customers with high performance and value.
Consider the following when choosing your instances: Core count,
Memory size, Storage size & type, Network performance, & CPU
technologies.
Hurry Up & Go Idle - A larger compute instance can save you time and
money, therefore paying more per hour for a shorter amount of time
can be less expensive.
Get the Intel® Advantage
Intel’s latest 22nm Haswell microarchitecture on new C4 instances,
with custom Intel® Xeon® v3 processors, provides new features:
Haswell microarchitecture has better branch prediction; greater
efficiency at prefetching instructions and data; along with other
improvements that can boost existing applications’ performance by
30% or more.
P state and C state control provides the ability to individually tune each
cores performance and sleep states to improve application
performance.
Intel® AVX2.0 instructions can double the floating-point performance for
compute-intensive workloads over Intel® AVX, and provide additional
instructions useful for compression and encryption.
Intel® Processor Technologies
Intel® AVX – Get dramatically better performance for highly
parallel HPC workloads such as life science engineering, data
mining, financial analysis, or other technical computing
applications. AVX also enhances image, video, and audio
processing.
Intel® AES-NI – Enhance your security with these new
encryption instructions that reduce the performance penalty
associated with encrypting/decrypting data.
Intel® Turbo Boost Technology – Get more computing power
when you need it with performance that adapts to spikes in your
workload with Intel® Turbo Boost Technology 2.0
EC2 Instances with Intel® Technologies
Infrastructure as Code
Background
Moving to the cloud and AWS allows you to provision and
manage infrastructure in new ways:
• Infrastructure can be provisioned in seconds
• Scale can be achieved without complicated capacity
planning
• APIs let you interact with infrastructure using languages
typically used in applications
What is Infrastructure as Code?
A practice in which traditional infrastructure management
techniques are supplemented by or replaced with code-
based tools and software development techniques.
Infrastructure as Code workflow
Code
Version
Control
Code
Review
Integrate Deploy
Infrastructure as Code workflow
Code
Version
Control
Code
Review
Integrate Deploy
Text Editor
Git/SVN/
Perforce
Review
Tools
Syntax
Validation
Tools
AWS
Services
Infrastructure as Code workflow
“It’s all software”
Code
Version
Control
Code
Review
Integrate Deploy
Text Editor
Git/SVN/P
erforce
Review
Tools
Syntax
Validation
Tools
AWS
Services
Application Configuration
AWS Resources
Infrastructure as Code workflow
Operating System and Host Configuration
AWS Resources
Operating System and
Host Configuration
Application Configuration
AWS Resources
Operating System and
Host Configuration
Application Configuration
Infrastructure Resource
Management
AWS Resources
Operating System and
Host Configuration
Application Configuration
Infrastructure Resource
Management
Host Configuration
Management
AWS Resources
Operating System and
Host Configuration
Application Configuration
Infrastructure Resource
Management
Host Configuration
Management
Application Deployment
AWS Resources
Operating System and
Host Configuration
Application Configuration
AWS CloudFormation
AWS OpsWorks
AWS CodeDeploy
AWS Resources
Operating System and
Host Configuration
Application Configuration
AWS CloudFormation
AWS OpsWorks
AWS CodeDeploy
Amazon Virtual Private
Cloud (VPC)
Amazon Elastic Compute
Cloud (EC2)
AWS Identity and Access
Management (IAM)
Amazon Relational Database
Service (RDS)
Amazon Simple Storage
Service (S3)
AWS CodePipeline
…
Windows Registry
Linux Networking
OpenSSH
LDAP
AD Domain Registration
Centralized logging
System Metrics
Deployment agents
Host monitoring
…
Application dependencies
Application configuration
Service registration
Management scripts
Database credentials
…
allOfThis == $Code
AWS CloudFormation
• Create templates that describe
and model AWS infrastructure
• CloudFormation then provisions
AWS resources based on
dependency needs
• Version control/replicate/update
the templates like app code
• Integrates with development,
CI/CD, management tools
• No additional charge to use
Benefits
Templated resource
provisioning
Infrastructure
as code
Declarative
and flexible
Easy to use
CloudFormation concepts and technology
JSON formatted file
Parameter definition
Resource creation
Configuration actions
Framework
Stack creation
Stack updates
Error detection and rollback
Configured AWS resources
Comprehensive service support
Service event aware
Customizable
Template CloudFormation Stack
Anatomy of a CloudFormation template: JSON
Plain Text
Perfect for version control
Can be validated
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template
EC2InstanceSample: **WARNING** This template an Amazon EC2 instances.
You will be billed for the AWS resources used if you create a stack
from this template.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH
access to the instance",
"Type" : "String"
},
"Environment": {
"Type" : "String",
"Default" : ”Dev",
"AllowedValues" : [”Mgmt", "Dev", ”Staging", "Prod"],
"Description" : "Environment that the instances will run in.”
}
},
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "AMI" : "ami-7f418316" },
"us-west-2" : { "AMI" : "ami-16fd7026" }
}
},
"Conditions" : {
”EnableEBSOptimized" : {"Fn::Equals" : [{"Ref" : " Environment
"}, ”Prod"]},
},
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"EbsOptimized " : {"Fn::If": [ " EnableEBSOptimized ",
{“true”}, {“false”}]},
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" :
"AWS::Region" }, "AMI" ]},
"UserData" : { "Fn::Base64" : "80" }
}
}
},
"Outputs" : {
"InstanceId" : {
"Description" : "InstanceId of the newly created EC2 instance",
"Value" : { "Ref" : "Ec2Instance" }
},
"PublicDNS" : {
"Description" : "Public DNSName of the newly created EC2
instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }
}
}
}
Anatomy of a CloudFormation template: JSON
Parameters
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable
SSH access to the instance",
"Type" : "String"
},
"Environment": {
"Type" : "String",
"Default" : ”Dev",
"AllowedValues" : [”Mgmt", "Dev", ”Staging", "Prod"],
"Description" : "Environment that the instances will run
in.”
}
},
Mappings
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "AMI" : "ami-7f418316" },
"us-west-2" : { "AMI" : "ami-16fd7026" }
}
},
Conditionals
"Conditions" : {
”EnableEBSOptimized" : {"Fn::Equals" : [{"Ref" : " Environment "}, ”Prod"]},
},
Resources
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"EbsOptimized " : {"Fn::If": [ " EnableEBSOptimized ", {“true”}, {“false”}]},
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" },
"AMI" ]},
"UserData" : { "Fn::Base64" : "80" }
}
}
},
Outputs
Outputs" : {
"InstanceId" : {
"Description" : "InstanceId of the newly created EC2 instance",
"Value" : { "Ref" : "Ec2Instance" }
},
"PublicDNS" : {
"Description" : "Public DNSName of the newly created EC2 instance",
"Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }
}
}
}
Headers
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudFormation Sample Template
EC2InstanceSample: **WARNING** This template an Amazon EC2
instances. You will be billed for the AWS resources used if you
create a stack from this template.",
Anatomy of a CloudFormation template: JSON
Description of what your stack does, contains, etc
Provision time values that add structured flexibility and customization
Pre-defined conditional case statements
Conditional values set via evaluations of passed references
AWS resource definitions
Resulting attributes of stack resource creation
Headers
Parameters
Mappings
Conditionals
Resources
Outputs
Template components
Bootstrapping applications & handling updates
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"KeyName" : { "Ref" : "KeyName" },
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[
"#!/bin/bash -ex","n",
"yum -y install gcc-c++ make","n",
"yum -y install mysql-devel sqlite-devel","n",
"yum -y install ruby-rdoc rubygems ruby-mysql ruby-devel","n",
"gem install --no-ri --no-rdoc rails","n",
"gem install --no-ri --no-rdoc mysql","n",
"gem install --no-ri --no-rdoc sqlite3","n",
"rails new myapp","n",
"cd myapp","n",
"rails server -d","n"]]}}
}
}
Option 1: Use EC2 UserData, which is available as a property of
AWS::EC2::Instance resources
cfn-init
cfn-hup
Option 2: AWS CloudFormation
provides helper scripts for
deployment within your EC2
instances
Metadata Key —
AWS::CloudFormation::Init
Cfn-init reads this metadata key and
installs the packages listed in this key
(e.g., httpd, mysql, and php). Cfn-init
also retrieves and expands files listed
as sources.
Amazon EC2
AWS CloudFormation
cfn-signal
cfn-get-
metadata
Bootstrapping applications & handling updates
Manage a wide range of AWS services & resources
• Amazon EC2
• Amazon EC2 Container Service
• Amazon EC2 Container Registry
• Amazon EC2 Simple Systems Manager
• AWS Lambda (including event sources)
• AWS Elastic Beanstalk
• Auto Scaling (including Spot Fleet)
• Amazon VPC & Managed NAT Gateway
• Elastic Load Balancing
• Amazon Route 53
• Amazon CloudFront
• AWS WAF
• Amazon S3
• Amazon RDS
• Amazon Redshift
• Amazon DynamoDB
• Amazon ElastiCache
• Amazon RDS (including Aurora)
• Amazon Elastic MapReduce
• Amazon Elasticsearch Service
• AWS Data Pipeline
• Amazon IAM (including managed policies)
• Amazon Simple AD / Microsoft AD
• Amazon Kinesis
• Amazon SNS
• Amazon SQS
• AWS CloudTrail
• Amazon CloudWatch
• AWS Config
• AWS Key Management Service
• AWS OpsWorks
• AWS CodeDeploy
• AWS CodePipeline
• Amazon Workspaces
• Amazon GameLift
AWS resource support is always growing. See up to date list here.
Template File
Defining Stack
• The entire infrastructure can
be represented in an AWS
CloudFormation template.
Many stacks & environments from one template
Template File
Defining Stack
• The entire infrastructure can
be represented in an AWS
CloudFormation template.
• Use the version control
system of your choice to
store and track changes to
this template
Git
Perforce
SVN
…
Many stacks & environments from one template
Template File
Defining Stack
• The entire infrastructure can
be represented in an AWS
CloudFormation template.
• Use the version control
system of your choice to
store and track changes to
this template
• Build out multiple
environments, such as for
Development, Test,
Production and even DR
using the same template
Git
Perforce
SVN
…
Dev
Test
Prod
Many stacks & environments from one template
Infrastructure as Code with CloudFormation
Versioning
You track changes within your code
Do it with your infrastructure:
• What is changing?
• Who made that change?
• When was it made?
• Why was it made?(tied to ticket/bug/project systems?)
Testing your template:
• Validate via API/CLI
• $ aws cloudformation validate-template – confirm CF
syntax
• Use something like Jsonlint (http://jsonlint.com/) to find
JSON issues like missing commas, brackets
• Throw this into your testing/continuous integration pipelines
Testing your CloudFormation templates
Visualizing your CloudFormation templates
• AWS
CloudFormation
Designer
• Visualize template
resources
• Modify template with
drag-drop gestures
• Customize sample
templates
Deploying your CloudFormation templates
Deploy & update via console or API/command line
OR
• aws cloudformation create-stack --stack-name
myteststack --template-body
file:////home//local//test//sampletemplate.json --
parameters
ParameterKey=string,ParameterValue=string
But what do we do once your
resources are provisioned and
running?
Your infrastructure needs ongoing management
• Updates/patches?
• New software?
• New configurations?
• New code deploys?
• Pool specific changes?
• Environment specific changes?
• Run commands across all hosts?
• Be on top of all running resources?
Ongoing management requires proper tooling
Some common challenges:
• Changing a vhost configuration on every web server across
multiple environments (dev, stage, prod)
• Installing a package on certain hosts to test out newer versions
• Changing LDAP config on every running Amazon EC2 Linux host
when they are across 25 different CloudFormation templates
We need a tool to interact with
each host that we manage and
make it easier to configure
them
• Configuration management service
for automating operational tasks
using Chef
• Model, control and automate
applications of nearly any scale and
complexity
• Manage Linux and Windows
environments
• Supports both AWS and on-
premises servers
• Launched in 2013
AWS OpsWorks
AWS OpsWorks concepts
A stack represents
the cloud
infrastructure and
applications that
you want to manage
together.
A layer defines how
to setup and
configure a set of
instances and
related resources.
Decide how to
scale: manually,
with 24/7 instances,
or automatically,
with load-based or
time-based
instances.
Then deploy your
app to specific
instances and
customize the
deployment with
Chef recipes.
AWS OpsWorks concepts: instance lifecycle
Setup Configure Deploy Undeploy Shutdown
Agent on each instance understands a set
of commands that are triggered by
OpsWorks. The agent then runs Chef.
OpsWorks agent communication
1. Instance connects with OpsWorks
service to send keep alive heartbeat
and receive lifecycle events
2. OpsWorks sends lifecycle event with
pointer to configuration JSON
(metadata, recipes) in S3 bucket
3. Download configuration JSON
4. Pull cookbooks and other build assets
from your repo
5. Execute recipe
6. Upload Chef log
7. Report Chef run status
EC2
Instance
OpsWorks
Service
“Deploy App”
Your repo,
e.g. GitHub







How OpsWorks bootstraps EC2 instances
Instance is started with IAM role
• UserData passed with instance private key, OpsWorks public key
• Instance downloads and installs OpsWorks agent
Agent connects to instance service, gets run info
• Authenticate instance using instance’s IAM role
• Pick-up configuration JSON from the OpsWorks instance queue
• Decrypt & verify message, run Chef recipes
• Upload Chef log, return Chef run status
Agent polls instance service for more messages
AWS OpsWorks + Chef
OpsWorks uses Chef to configure the software on the
instance
OpsWorks provides many Chef Server functions to users.
• Associate cookbooks with instances
• Dynamic metadata that describes each registered node in the
infrastructure
Supports "Push" Command and Control Client Runs
Support for community cookbooks
Working with Chef and OpsWorks
Similar to CloudFormation templates and application code:
• Mixture of JSON and a Ruby DSL
• Tools exist to do linting and syntax checking
• Versioning
• Built in cookbook versioning
• Some manual/processes scripted abilities
• But still can use source control for versioning
• Use with continuous integration systems just like AWS
CloudFormation templates and the rest of your code
AWS OpsWorks
Deploying applications
Automates code deployments to any instance
Handles the complexity of updating your
applications
Avoid downtime during application deployment
Deploy to Amazon EC2 or on-premise servers,
in any language and on any operating system
Integrates with 3rd party tools and AWS
services
AWS CodeDeploy
AWS CodeDeploy concepts
Application
Revision #1
Revision #2
Revision #3
What to deploy?
Revision #1
How to deploy?
Instance
Instance
Instance
Deployment Group
Auto-Scaling Group
Where to deploy?
version: 0.0
os: linux
files:
- source: /
destination: /var/www/html
• Send application files to one
directory and configuration files to
another
• Set specific permissions on specific
directories & files
• Remove/Add instance to ELB
• Install dependency packages
• Start Apache
• Confirm successful deploy
• More!
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
How It Works: Package app with Appspec.yml
How It Works: Specify targets
Group instances by:
• Auto Scaling Group
• Amazon EC2 Tag
• On-Premises Tag
Dev Deployment Group
AgentAgent Agent
Prod Deployment Group
AgentAgent Agent
AgentAgent Agent
How It Works: Deploy
• AWS CLI & SDKs
• AWS Console
• AWS CodePipeline & CI/CD Partners
• S3, GitHub
aws deploy create-deployment 
--application-name MyApp 
--deployment-group-name TargetGroup 
--s3-location bucket=MyBucket,key=MyApp.zip
v2 v1 v1 v1 v1 v1 v1 v1
v2 v2 v1 v1 v1 v1 v1 v1
v2 v2 v2 v2 v1 v1 v1 v1
v2 v2 v2 v2 v2 v2 v2 v2
One-at-a-time
Min. healthy hosts = 99%
[Custom]
Min. healthy hosts = 75%
Half-at-a-time
Min. healthy hosts = 50%
All-at-once
Min. healthy hosts = 0
Choose your deployment configuration
Summary
Summary
• Create/update/manage AWS resources and their configuration and
properties with CloudFormation
• You can configure OpsWorks and CodeDeploy via
CloudFormation
• Use OpsWorks for ongoing tweaks to software/configuration of host
based applications and the operating system
• You can configure and deploy CodeDeploy’s agent with
OpsWorks
• Use CodeDeploy to deploy your applications and their configurations
Best practices
• Your CloudFormation templates and Chef cookbooks should
go in separate repositories
• Include appspec.yml file and related scripts in your
application’s code repositories
• Every commit should cause an execution of your continuous
delivery pipeline to lint, validate and/or test
• Use each related service’s CLI/console/APIs to update or
deploy as necessary
AWS Resources
Operating System and
Host Configuration
Application Configuration
AWS CloudFormation
AWS OpsWorks
AWS CodeDeploy
Amazon Virtual Private
Cloud (VPC)
Amazon Elastic Compute
Cloud (EC2)
AWS Identity and Access
Management (IAM)
Amazon Relational Database
Service (RDS)
Amazon Simple Storage
Service (S3)
AWS CodePipeline
…
Windows Registry
Linux Networking
OpenSSH
LDAP
AD Domain Registration
Centralized logging
System Metrics
Deployment agents
Host monitoring
…
Application dependencies
Application configuration
Service registration
Management scripts
Database credentials
…
allOfThis == $Code
Learn More
• AWS CloudFormation
• https://aws.amazon.com/cloudformation/
• https://aws.amazon.com/documentation/cloudformation/
• https://aws.amazon.com/cloudformation/aws-cloudformation-templates/
• AWS OpsWorks
• https://aws.amazon.com/opsworks/
• https://aws.amazon.com/documentation/opsworks/
• https://github.com/aws/opsworks-cookbooks
• AWS CodeDeploy
• https://aws.amazon.com/codedeploy/
• https://aws.amazon.com/documentation/codedeploy/
• https://github.com/awslabs/aws-codedeploy-samples

More Related Content

Managing Your Infrastructure as Code

  • 1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Bob Griffiths, Solutions Architect Manager September 21st 2016 Infrastructure as Code Introduction to Best Practices on AWS
  • 2. Learning Objectives • Choosing the right EC2 instances • Infrastructure as code • AWS services that help you manage your infrastructure as code • Best practices for managing your AWS infrastructure, host configuration, and applications
  • 3. Choosing the Right Amazon EC2 Instance EC2 Instance types are optimized for different use cases & come in multiple sizes. This allows you to optimally scale resources to your workload requirements. AWS utilizes Intel® Xeon® processors for EC2 Instances providing customers with high performance and value. Consider the following when choosing your instances: Core count, Memory size, Storage size & type, Network performance, & CPU technologies. Hurry Up & Go Idle - A larger compute instance can save you time and money, therefore paying more per hour for a shorter amount of time can be less expensive.
  • 4. Get the Intel® Advantage Intel’s latest 22nm Haswell microarchitecture on new C4 instances, with custom Intel® Xeon® v3 processors, provides new features: Haswell microarchitecture has better branch prediction; greater efficiency at prefetching instructions and data; along with other improvements that can boost existing applications’ performance by 30% or more. P state and C state control provides the ability to individually tune each cores performance and sleep states to improve application performance. Intel® AVX2.0 instructions can double the floating-point performance for compute-intensive workloads over Intel® AVX, and provide additional instructions useful for compression and encryption.
  • 5. Intel® Processor Technologies Intel® AVX – Get dramatically better performance for highly parallel HPC workloads such as life science engineering, data mining, financial analysis, or other technical computing applications. AVX also enhances image, video, and audio processing. Intel® AES-NI – Enhance your security with these new encryption instructions that reduce the performance penalty associated with encrypting/decrypting data. Intel® Turbo Boost Technology – Get more computing power when you need it with performance that adapts to spikes in your workload with Intel® Turbo Boost Technology 2.0
  • 6. EC2 Instances with Intel® Technologies
  • 8. Background Moving to the cloud and AWS allows you to provision and manage infrastructure in new ways: • Infrastructure can be provisioned in seconds • Scale can be achieved without complicated capacity planning • APIs let you interact with infrastructure using languages typically used in applications
  • 9. What is Infrastructure as Code? A practice in which traditional infrastructure management techniques are supplemented by or replaced with code- based tools and software development techniques.
  • 10. Infrastructure as Code workflow Code Version Control Code Review Integrate Deploy
  • 11. Infrastructure as Code workflow Code Version Control Code Review Integrate Deploy Text Editor Git/SVN/ Perforce Review Tools Syntax Validation Tools AWS Services
  • 12. Infrastructure as Code workflow “It’s all software” Code Version Control Code Review Integrate Deploy Text Editor Git/SVN/P erforce Review Tools Syntax Validation Tools AWS Services
  • 13. Application Configuration AWS Resources Infrastructure as Code workflow Operating System and Host Configuration
  • 14. AWS Resources Operating System and Host Configuration Application Configuration
  • 15. AWS Resources Operating System and Host Configuration Application Configuration Infrastructure Resource Management
  • 16. AWS Resources Operating System and Host Configuration Application Configuration Infrastructure Resource Management Host Configuration Management
  • 17. AWS Resources Operating System and Host Configuration Application Configuration Infrastructure Resource Management Host Configuration Management Application Deployment
  • 18. AWS Resources Operating System and Host Configuration Application Configuration AWS CloudFormation AWS OpsWorks AWS CodeDeploy
  • 19. AWS Resources Operating System and Host Configuration Application Configuration AWS CloudFormation AWS OpsWorks AWS CodeDeploy Amazon Virtual Private Cloud (VPC) Amazon Elastic Compute Cloud (EC2) AWS Identity and Access Management (IAM) Amazon Relational Database Service (RDS) Amazon Simple Storage Service (S3) AWS CodePipeline … Windows Registry Linux Networking OpenSSH LDAP AD Domain Registration Centralized logging System Metrics Deployment agents Host monitoring … Application dependencies Application configuration Service registration Management scripts Database credentials …
  • 21. AWS CloudFormation • Create templates that describe and model AWS infrastructure • CloudFormation then provisions AWS resources based on dependency needs • Version control/replicate/update the templates like app code • Integrates with development, CI/CD, management tools • No additional charge to use
  • 23. CloudFormation concepts and technology JSON formatted file Parameter definition Resource creation Configuration actions Framework Stack creation Stack updates Error detection and rollback Configured AWS resources Comprehensive service support Service event aware Customizable Template CloudFormation Stack
  • 24. Anatomy of a CloudFormation template: JSON Plain Text Perfect for version control Can be validated
  • 25. { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "AWS CloudFormation Sample Template EC2InstanceSample: **WARNING** This template an Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", "Parameters" : { "KeyName" : { "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", "Type" : "String" }, "Environment": { "Type" : "String", "Default" : ”Dev", "AllowedValues" : [”Mgmt", "Dev", ”Staging", "Prod"], "Description" : "Environment that the instances will run in.” } }, "Mappings" : { "RegionMap" : { "us-east-1" : { "AMI" : "ami-7f418316" }, "us-west-2" : { "AMI" : "ami-16fd7026" } } }, "Conditions" : { ”EnableEBSOptimized" : {"Fn::Equals" : [{"Ref" : " Environment "}, ”Prod"]}, }, "Resources" : { "Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "KeyName" : { "Ref" : "KeyName" }, "EbsOptimized " : {"Fn::If": [ " EnableEBSOptimized ", {“true”}, {“false”}]}, "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, "UserData" : { "Fn::Base64" : "80" } } } }, "Outputs" : { "InstanceId" : { "Description" : "InstanceId of the newly created EC2 instance", "Value" : { "Ref" : "Ec2Instance" } }, "PublicDNS" : { "Description" : "Public DNSName of the newly created EC2 instance", "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] } } } } Anatomy of a CloudFormation template: JSON
  • 26. Parameters "Parameters" : { "KeyName" : { "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", "Type" : "String" }, "Environment": { "Type" : "String", "Default" : ”Dev", "AllowedValues" : [”Mgmt", "Dev", ”Staging", "Prod"], "Description" : "Environment that the instances will run in.” } }, Mappings "Mappings" : { "RegionMap" : { "us-east-1" : { "AMI" : "ami-7f418316" }, "us-west-2" : { "AMI" : "ami-16fd7026" } } }, Conditionals "Conditions" : { ”EnableEBSOptimized" : {"Fn::Equals" : [{"Ref" : " Environment "}, ”Prod"]}, }, Resources "Resources" : { "Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "KeyName" : { "Ref" : "KeyName" }, "EbsOptimized " : {"Fn::If": [ " EnableEBSOptimized ", {“true”}, {“false”}]}, "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, "UserData" : { "Fn::Base64" : "80" } } } }, Outputs Outputs" : { "InstanceId" : { "Description" : "InstanceId of the newly created EC2 instance", "Value" : { "Ref" : "Ec2Instance" } }, "PublicDNS" : { "Description" : "Public DNSName of the newly created EC2 instance", "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] } } } } Headers { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "AWS CloudFormation Sample Template EC2InstanceSample: **WARNING** This template an Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", Anatomy of a CloudFormation template: JSON
  • 27. Description of what your stack does, contains, etc Provision time values that add structured flexibility and customization Pre-defined conditional case statements Conditional values set via evaluations of passed references AWS resource definitions Resulting attributes of stack resource creation Headers Parameters Mappings Conditionals Resources Outputs Template components
  • 28. Bootstrapping applications & handling updates "Resources" : { "Ec2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "KeyName" : { "Ref" : "KeyName" }, "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, "UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[ "#!/bin/bash -ex","n", "yum -y install gcc-c++ make","n", "yum -y install mysql-devel sqlite-devel","n", "yum -y install ruby-rdoc rubygems ruby-mysql ruby-devel","n", "gem install --no-ri --no-rdoc rails","n", "gem install --no-ri --no-rdoc mysql","n", "gem install --no-ri --no-rdoc sqlite3","n", "rails new myapp","n", "cd myapp","n", "rails server -d","n"]]}} } } Option 1: Use EC2 UserData, which is available as a property of AWS::EC2::Instance resources
  • 29. cfn-init cfn-hup Option 2: AWS CloudFormation provides helper scripts for deployment within your EC2 instances Metadata Key — AWS::CloudFormation::Init Cfn-init reads this metadata key and installs the packages listed in this key (e.g., httpd, mysql, and php). Cfn-init also retrieves and expands files listed as sources. Amazon EC2 AWS CloudFormation cfn-signal cfn-get- metadata Bootstrapping applications & handling updates
  • 30. Manage a wide range of AWS services & resources • Amazon EC2 • Amazon EC2 Container Service • Amazon EC2 Container Registry • Amazon EC2 Simple Systems Manager • AWS Lambda (including event sources) • AWS Elastic Beanstalk • Auto Scaling (including Spot Fleet) • Amazon VPC & Managed NAT Gateway • Elastic Load Balancing • Amazon Route 53 • Amazon CloudFront • AWS WAF • Amazon S3 • Amazon RDS • Amazon Redshift • Amazon DynamoDB • Amazon ElastiCache • Amazon RDS (including Aurora) • Amazon Elastic MapReduce • Amazon Elasticsearch Service • AWS Data Pipeline • Amazon IAM (including managed policies) • Amazon Simple AD / Microsoft AD • Amazon Kinesis • Amazon SNS • Amazon SQS • AWS CloudTrail • Amazon CloudWatch • AWS Config • AWS Key Management Service • AWS OpsWorks • AWS CodeDeploy • AWS CodePipeline • Amazon Workspaces • Amazon GameLift AWS resource support is always growing. See up to date list here.
  • 31. Template File Defining Stack • The entire infrastructure can be represented in an AWS CloudFormation template. Many stacks & environments from one template
  • 32. Template File Defining Stack • The entire infrastructure can be represented in an AWS CloudFormation template. • Use the version control system of your choice to store and track changes to this template Git Perforce SVN … Many stacks & environments from one template
  • 33. Template File Defining Stack • The entire infrastructure can be represented in an AWS CloudFormation template. • Use the version control system of your choice to store and track changes to this template • Build out multiple environments, such as for Development, Test, Production and even DR using the same template Git Perforce SVN … Dev Test Prod Many stacks & environments from one template
  • 34. Infrastructure as Code with CloudFormation Versioning You track changes within your code Do it with your infrastructure: • What is changing? • Who made that change? • When was it made? • Why was it made?(tied to ticket/bug/project systems?)
  • 35. Testing your template: • Validate via API/CLI • $ aws cloudformation validate-template – confirm CF syntax • Use something like Jsonlint (http://jsonlint.com/) to find JSON issues like missing commas, brackets • Throw this into your testing/continuous integration pipelines Testing your CloudFormation templates
  • 36. Visualizing your CloudFormation templates • AWS CloudFormation Designer • Visualize template resources • Modify template with drag-drop gestures • Customize sample templates
  • 37. Deploying your CloudFormation templates Deploy & update via console or API/command line OR • aws cloudformation create-stack --stack-name myteststack --template-body file:////home//local//test//sampletemplate.json -- parameters ParameterKey=string,ParameterValue=string
  • 38. But what do we do once your resources are provisioned and running?
  • 39. Your infrastructure needs ongoing management • Updates/patches? • New software? • New configurations? • New code deploys? • Pool specific changes? • Environment specific changes? • Run commands across all hosts? • Be on top of all running resources?
  • 40. Ongoing management requires proper tooling Some common challenges: • Changing a vhost configuration on every web server across multiple environments (dev, stage, prod) • Installing a package on certain hosts to test out newer versions • Changing LDAP config on every running Amazon EC2 Linux host when they are across 25 different CloudFormation templates
  • 41. We need a tool to interact with each host that we manage and make it easier to configure them
  • 42. • Configuration management service for automating operational tasks using Chef • Model, control and automate applications of nearly any scale and complexity • Manage Linux and Windows environments • Supports both AWS and on- premises servers • Launched in 2013 AWS OpsWorks
  • 43. AWS OpsWorks concepts A stack represents the cloud infrastructure and applications that you want to manage together. A layer defines how to setup and configure a set of instances and related resources. Decide how to scale: manually, with 24/7 instances, or automatically, with load-based or time-based instances. Then deploy your app to specific instances and customize the deployment with Chef recipes.
  • 44. AWS OpsWorks concepts: instance lifecycle Setup Configure Deploy Undeploy Shutdown Agent on each instance understands a set of commands that are triggered by OpsWorks. The agent then runs Chef.
  • 45. OpsWorks agent communication 1. Instance connects with OpsWorks service to send keep alive heartbeat and receive lifecycle events 2. OpsWorks sends lifecycle event with pointer to configuration JSON (metadata, recipes) in S3 bucket 3. Download configuration JSON 4. Pull cookbooks and other build assets from your repo 5. Execute recipe 6. Upload Chef log 7. Report Chef run status EC2 Instance OpsWorks Service “Deploy App” Your repo, e.g. GitHub       
  • 46. How OpsWorks bootstraps EC2 instances Instance is started with IAM role • UserData passed with instance private key, OpsWorks public key • Instance downloads and installs OpsWorks agent Agent connects to instance service, gets run info • Authenticate instance using instance’s IAM role • Pick-up configuration JSON from the OpsWorks instance queue • Decrypt & verify message, run Chef recipes • Upload Chef log, return Chef run status Agent polls instance service for more messages
  • 47. AWS OpsWorks + Chef OpsWorks uses Chef to configure the software on the instance OpsWorks provides many Chef Server functions to users. • Associate cookbooks with instances • Dynamic metadata that describes each registered node in the infrastructure Supports "Push" Command and Control Client Runs Support for community cookbooks
  • 48. Working with Chef and OpsWorks Similar to CloudFormation templates and application code: • Mixture of JSON and a Ruby DSL • Tools exist to do linting and syntax checking • Versioning • Built in cookbook versioning • Some manual/processes scripted abilities • But still can use source control for versioning • Use with continuous integration systems just like AWS CloudFormation templates and the rest of your code
  • 51. Automates code deployments to any instance Handles the complexity of updating your applications Avoid downtime during application deployment Deploy to Amazon EC2 or on-premise servers, in any language and on any operating system Integrates with 3rd party tools and AWS services AWS CodeDeploy
  • 52. AWS CodeDeploy concepts Application Revision #1 Revision #2 Revision #3 What to deploy? Revision #1 How to deploy? Instance Instance Instance Deployment Group Auto-Scaling Group Where to deploy?
  • 53. version: 0.0 os: linux files: - source: / destination: /var/www/html • Send application files to one directory and configuration files to another • Set specific permissions on specific directories & files • Remove/Add instance to ELB • Install dependency packages • Start Apache • Confirm successful deploy • More! 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 How It Works: Package app with Appspec.yml
  • 54. How It Works: Specify targets Group instances by: • Auto Scaling Group • Amazon EC2 Tag • On-Premises Tag Dev Deployment Group AgentAgent Agent Prod Deployment Group AgentAgent Agent AgentAgent Agent
  • 55. How It Works: Deploy • AWS CLI & SDKs • AWS Console • AWS CodePipeline & CI/CD Partners • S3, GitHub aws deploy create-deployment --application-name MyApp --deployment-group-name TargetGroup --s3-location bucket=MyBucket,key=MyApp.zip
  • 56. v2 v1 v1 v1 v1 v1 v1 v1 v2 v2 v1 v1 v1 v1 v1 v1 v2 v2 v2 v2 v1 v1 v1 v1 v2 v2 v2 v2 v2 v2 v2 v2 One-at-a-time Min. healthy hosts = 99% [Custom] Min. healthy hosts = 75% Half-at-a-time Min. healthy hosts = 50% All-at-once Min. healthy hosts = 0 Choose your deployment configuration
  • 58. Summary • Create/update/manage AWS resources and their configuration and properties with CloudFormation • You can configure OpsWorks and CodeDeploy via CloudFormation • Use OpsWorks for ongoing tweaks to software/configuration of host based applications and the operating system • You can configure and deploy CodeDeploy’s agent with OpsWorks • Use CodeDeploy to deploy your applications and their configurations
  • 59. Best practices • Your CloudFormation templates and Chef cookbooks should go in separate repositories • Include appspec.yml file and related scripts in your application’s code repositories • Every commit should cause an execution of your continuous delivery pipeline to lint, validate and/or test • Use each related service’s CLI/console/APIs to update or deploy as necessary
  • 60. AWS Resources Operating System and Host Configuration Application Configuration AWS CloudFormation AWS OpsWorks AWS CodeDeploy Amazon Virtual Private Cloud (VPC) Amazon Elastic Compute Cloud (EC2) AWS Identity and Access Management (IAM) Amazon Relational Database Service (RDS) Amazon Simple Storage Service (S3) AWS CodePipeline … Windows Registry Linux Networking OpenSSH LDAP AD Domain Registration Centralized logging System Metrics Deployment agents Host monitoring … Application dependencies Application configuration Service registration Management scripts Database credentials …
  • 62. Learn More • AWS CloudFormation • https://aws.amazon.com/cloudformation/ • https://aws.amazon.com/documentation/cloudformation/ • https://aws.amazon.com/cloudformation/aws-cloudformation-templates/ • AWS OpsWorks • https://aws.amazon.com/opsworks/ • https://aws.amazon.com/documentation/opsworks/ • https://github.com/aws/opsworks-cookbooks • AWS CodeDeploy • https://aws.amazon.com/codedeploy/ • https://aws.amazon.com/documentation/codedeploy/ • https://github.com/awslabs/aws-codedeploy-samples

Editor's Notes

  1. Choosing the right EC2 Instance type matters. Selecting an appropriate instance type for your workload can save time and money. AWS has a wide variety of EC2 compute instance types to choose from. Each Instance type or family (like T2, M3, C4,C3, G2, R3, and so on) is optimized for different workloads or use cases. Within an EC2 family, you can choose from different sizes for example micro, small, medium, large, xlarge, 2xlarge, and so on. AWS utilizes Intel® Xeon® processors for the EC2 Instances to provide customers with high performance and value for their computing needs. When you choose your instance type you should consider the several different attributes of each family; such as number of cores, amount of memory, amount & type of storage, network performance, and processor technologies. Another important consideration is TCO. A lowest-price per hour instance is not necessarily a money saver; a larger compute instance can sometimes save both money and time. It is important to evaluate all the options to see what is best for your workload.
  2. AWS recently launched C4 compute-optimized instances which utilize Intel’s latest 22nm Haswell microarchitecture. C4 instances use custom Intel® Xeon® v3 processors designed and built especially for AWS. Through its relationship with Intel®, AWS provides its customers with the latest and greatest Intel® Xeon® processors that help in delivering the highest level of processor performance in EC2.
  3. Intel® Xeon® processors have several other important technology features that can be leveraged by EC2 Instances. Intel® AVX is perfect for highly parallel HPC workloads such as life sciences or financial analysis. Intel® AES-NI accelerates encryption/decryption of data and therefore reduces the performance penalty that usually comes with encryption. Intel® Turbo Boost Technology automatically gives you more computing power when your workloads are not fully utilizing all CPU cores. Think of it as automatic overclocking when you have thermal headroom.
  4. The matrix on the slide highlights the individual Intel® technologies that were discussed previously and the EC2 instance family that can leverage each of these technologies. A complete list of Amazon EC2 Instance types can be found here: http://aws.amazon.com/ec2/instance-types/
  5. The development process that you use for developing business logic can be the same as what you when writing CloudFormation templates. You start of with your favorite IDE or Text Editor to write the code, Eclipse, VIM or VisualStudio You then commit to template to your source code repository using your usual branching strategy and then have the template reviewed as part of your typical code review process. The template is then integrated and run as part of your CI and CD pipelines. Being simply a JSON document, you can even write Unit Tests for your templates. When developing a CloudFormation template you can use all of your normal software engineering principles At the end of the day It’s all software – a template can be reused across applications – just like code library's and a stack can be shared by multiple applications.
  6. The development process that you use for developing business logic can be the same as what you when writing CloudFormation templates. You start of with your favorite IDE or Text Editor to write the code, Eclipse, VIM or VisualStudio You then commit to template to your source code repository using your usual branching strategy and then have the template reviewed as part of your typical code review process. The template is then integrated and run as part of your CI and CD pipelines. Being simply a JSON document, you can even write Unit Tests for your templates. When developing a CloudFormation template you can use all of your normal software engineering principles At the end of the day It’s all software – a template can be reused across applications – just like code library's and a stack can be shared by multiple applications.
  7. The development process that you use for developing business logic can be the same as what you when writing CloudFormation templates. You start of with your favorite IDE or Text Editor to write the code, Eclipse, VIM or VisualStudio You then commit to template to your source code repository using your usual branching strategy and then have the template reviewed as part of your typical code review process. The template is then integrated and run as part of your CI and CD pipelines. Being simply a JSON document, you can even write Unit Tests for your templates. When developing a CloudFormation template you can use all of your normal software engineering principles At the end of the day It’s all software – a template can be reused across applications – just like code library's and a stack can be shared by multiple applications.
  8. So if you look at the components behind Cloudformation. It's starts off with a template. This is the JSON formatted script file, that deals with things like parameter definition that drive a user driven template, such as name of my databases. It deals with the resource creation, so the creation of AWS components such as EC2 instances or RDS databases. And it deals with the configuration actions I wish to apply against this resources, so it might be install software or might be creating an SQS queue for example. Than that template is deployed into the cloud formation framework. And the framework deals what we call Stack creation, updates and any error detection and rollback required in the creation of a stack. So a stack is collection of resources that you want to manage together. And the resulting artifact is what we call a Stack of configured AWS services. So this could be in an Elastic Load Balancer and Autosclaing group with EC2 instances and an RDS database. So the stack is service event aware, the stack creation actions or the changing of that environment can be feed back into Cloudfomration and trigger actions within the CloudFormation tempalte. And it is also customizable, so once you created a stack you can of course access the underlying resources and change them of modify them as you so which. Now the error detection and rollback is an interesting point. If at any time in the stack creation a problem is detected, the default behaviour of Cloudformation is to roll-back the creation of all resources and put you back in a constitent known state. So you know if your stack is working or is rolled back and is not.
  9. AWS CloudFormation provides the following helpers to allow you to deploy your application code or application and OS configuration at the time you launch your EC2 instances: cfn-init: Used to retrieve and interpret the resource metadata, installing packages, creating files and starting services. cfn-signal: A simple wrapper to signal a CloudFormation WaitCondition allowing you to synchronize other resources in the stack with the application being ready. cfn-get-metadata: A wrapper script making it easy to retrieve either all metadata defined for a resource or path to a specific key or subtree of the resource metadata. cfn-hup: A daemon to check for updates to metadata and execute custom hooks when the changes are detected.
  10. When we discuss infrastructure we are using it as a very broad term, it doesn’t just mean network compute and storage. As of today CloudFormation supports over 30 AWS services. A key benefit is the range of resources supported. We play catch up so that you don’t have to and are constantly expanding. Just in the last month we have extended AWS Lambda support to allow you to define event sources from kinesis or dynamoDB steams as well as setting up the right permissions so the lambda function can execute with the appropriate permissions. Now you can connect lambda functions to your data streams to process event-based data. Added the ability to create EC2 spot fleets allowing you to create and maintain a set of EC2 spot instances based on a launch specification and bid price Now support Aurora – allowing you to create an Arora database cluster along with the parameters you want to specify to configure the cluster and database SimpleAD CodeDeploy – now you can not only create your infrastructure, but also setup the deployment mechanism for your application – we allow you to define the applications and the deployment groups to use CodeDeploy to manage your application lifecycle on top of the infrastructure you create through CloudFormation Amazon workspaces – the ablity to provision Amazon workspaces in an automated and repeatable way – may be you create a new workspace for each AWS account you create. Now you can use CloudFormation to configure such things as CloudTrail, IAM users and groups, VPCs and now Workspaces for that new account On top of this. The recently release Lambda backed Custom Resources you can now use Lambda functions to support things that CloudFormation does not support – we’ll talk more about Lambda custom resources later in the session.
  11. Notes: The entire application can be represented in an AWS CloudFormation template. You can use the version control system of your choice to store and track changes to this template. You can use the template to quickly build out multiple environments, such as for Development, Test, and Production.
  12. Notes: The entire application can be represented in an AWS CloudFormation template. You can use the version control system of your choice to store and track changes to this template. You can use the template to quickly build out multiple environments, such as for Development, Test, and Production.
  13. Notes: The entire application can be represented in an AWS CloudFormation template. You can use the version control system of your choice to store and track changes to this template. You can use the template to quickly build out multiple environments, such as for Development, Test, and Production.
  14. We’re going to model our application, starting with a stack that contains all the resources we’re going to use. Next, we’ll create a layer – it’s a blueprint for how we configure ec2 instances. We’ll create a PHP layer for our PHP app. We’ll create some instances and then deploy our application. Now our app, like many, needs to connect to a database for persistence. How can we create and configure the database, and then make sure our app connects to the database? The old way is we create the database table by hand, and then bake the connection info into the code. This is error prone because you can miss a step or later forget what you did when you need to recreate it. We really want configuration information such as the database table creation, user creation and all the metadata about the database to be managed like our source code. That way we can roll back changes. Fortunately, Chef gives us a way to do this.
  15. Setup is sent to the instance when it is instantiated or successfully booted. For example, the OpsWorks Rails application server layer uses the setup event to trigger a Chef recipe that installs dependencies like Apache, Ruby, Passenger, and Ruby on Rails. Configure notifies all instances whenever the state of the stack changes. For example, when a new instance is successfully added to an application server layer, the configure event triggers a Chef recipe that updates the OpsWorks Load Balancer layer configuration to reflect the added application server instance. Deploy is triggered whenever an application is deployed. For example, the OpsWorks Rails application server layer uses the deploy event to trigger a Chef recipe that executes the tasks needed to check out and download your application and tells Passenger to reload it. Undeploy is sent when you delete an application. For example, the undeploy event can trigger a custom Chef recipe that specifies any cleanup steps that need to be run, such as deleting database tables. Shutdown is sent to an instance 45 seconds before actually stopping the instance. For example, the shutdown event can trigger a custom Chef recipe that shuts down services.
  16. To use AWS CodeDeploy, you start by creating an application. An application consists of different components. A revision is a specific version of deployable content such as source code, post-build artifacts, web pages, executable files. A revision can be stored in GitHub or an Amazon S3 bucket. A deployment group is a set of Amazon EC2 instances associated with an application that you target for a deployment. You can add EC2 instances to a deployment group by specifying an EC2 tag and/or an Auto Scaling group name. A deployment configuration is a constraint that determines how a deployment progresses through the EC2 instances in a deployment group. In order to do a deployment, you simply specify these three parameters which answers the questions - what to deploy, where to deploy and how to deploy. You may be thinking how do you specify what files to copy and what deployment scripts to execute. To do this, you include a CodeDeploy specific configuration file in your revision.
  17. Next we prepare our deployment targets * We need to install the CodeDeploy agent on each server (Use a user-data script to bootstrap the installation or build the CodeDeploy agent into the base Amazon Machine Image.) * Then we group the target server fleets for your application by using EC2 tags, on-premises tags, or Auto Scaling Group. Integrating CodeDeploy with an Auto Scaling group is a common pattern.) * You can choose to divide your target groups however you'd like * For example, you can split between your development, testing, staging, and production environments
  18. Finally, it is time to deploy. You can use the CLI, an SDK, the Console, or one of our partner integrations like Jenkins, Travis CI, and GitHub to kick off a deployment. Since it's API based, we have a number of integrated partners You can monitor the deployment through the web console, and if troubles arise, to roll back an application to a previous revision, you just need to deploy that revision. AWS CodeDeploy keeps track of the files that were copied for the current revision and removes them before starting a new deployment, so there is no difference between redeploy and roll back.
  19. It’s important to note the flexibility you have when doing your deployments. When you create a deployment configuration, you control the setting for minimum-healthy-hosts. This will let you configure the speed of a deployment so you can balance availability and deployment duration For example, You could take a more conservative approach, updating one server at a time and monitoring for issues, prepared to redeploy the previous known good version if necessary. Or if it is important your entire application server fleet gets the latest revision ASAP, you can set min-healthy-hosts to 0. Hopefully you have seen the flexibility of CodeDeploy to manage applications deployments on EC2 or instances you manage on-premises.