SlideShare ist ein Scribd-Unternehmen logo
1 von 84
Automating your infrastructure deployment with
CloudFormation and OpsWorks
Richard Busby, Solutions Architect
Amazon Web Services
Business
101 Technical
201 Technical
301 Technical
401 Technical
Session Grading
• Repeatable deployments
• Versioned Infrastructure as code
• Use-case specific deployments
• Management at scale
• Application automation
Why treat your infrastructure as code?
• Repeatable deployments
• Versioned Infrastructure as code
• Use-case specific deployments
• Management at scale
• Application automation
A love story
A Simple Wordpress deployment with CloudFormation
Users
Web Server RDS Database
security group security group
Automating instance configuration: using cfn-init
"Resources" : {
"WebServer": {
"Type": "AWS::EC2::Instance",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo "Demo" > test.txt"
}
}
},
"UserData" : {
"/opt/aws/bin/cfn-init -s<stackID>
-r<ResourceID> --region <Region>"
}
• Packages
• Groups
• Users
• Sources
• Files
• Commands
• Services
Automating instance configuration: using cfn-init
"Resources" : {
"WebServer": {
"Type": "AWS::EC2::Instance",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo "Demo" > test.txt"
}
}
},
"UserData" : {
"/opt/aws/bin/cfn-init -s<stackID>
-r<ResourceID> --region <Region>"
}
• Packages
• Groups
• Users
• Sources
• Files
• Commands
• Services
Automating instance configuration: using cfn-init
"Resources" : {
"WebServer": {
"Type": "AWS::EC2::Instance",
"Metadata" : {
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo "Demo" > test.txt"
}
}
},
"UserData" : {
"/opt/aws/bin/cfn-init -s<stackID>
-r<ResourceID> --region <Region>"
}
• Packages
• Groups
• Users
• Sources
• Files
• Commands
• Services
How cfn-init works
instancestack
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo
"Demo" > test.txt"
}
}
}
}
AWS
CloudFormation
How cfn-init works
instancestack
#> cfn-init
-–stack <stackname>
--resource <resourcename>
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo
"Demo" > test.txt"
}
}
}
}
AWS
CloudFormation
How cfn-init works
instancestack
#> cfn-init
-–stack <stackname>
--resource <resourcename>
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo
"Demo" > test.txt"
}
}
}
}
Get metadata,
perform actions
AWS
CloudFormation
Signalling instance configuration: using
creationPolicy
"Resources" : {
"WebServer": {
"Type": "AWS::EC2::Instance",
"CreationPolicy": {
"ResourceSignal": {
"Count": "1",
"Timeout": "PT15M"
}
}
},
"Metadata" : {
"UserData" : {
"/opt/aws/bin/cfn-signal –-stack <stackID>
--resource <ResourceID> --success"
}
}
• Property of an EC2
instance or Auto Scaling
Group
• Inform CloudFormation
when configuration is
complete
Signalling instance configuration: using
creationPolicy
"Resources" : {
"WebServer": {
"Type": "AWS::EC2::Instance",
"CreationPolicy": {
"ResourceSignal": {
"Count": "1",
"Timeout": "PT15M"
}
}
},
"Metadata" : {
"UserData" : {
"/opt/aws/bin/cfn-signal –-stack <stackID>
--resource <ResourceID> --success"
}
}
• Property of an EC2
instance or Auto Scaling
Group
• Inform CloudFormation
when configuration is
complete
How creationPolicy works
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo
"Demo" > test.txt"
}
}
}
}
instancestackAWS
CloudFormation
How creationPolicy works
#> cfn-signal --success
--stack <stackname>
--resource <resourcename>
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo
"Demo" > test.txt"
}
}
}
}
instancestackAWS
CloudFormation
How creationPolicy works
#> cfn-signal --success
--stack <stackname>
--resource <resourcename>
Send completion
signal
"AWS::CloudFormation::Init" : {
"config" : {
"packages" : {
"httpd" : ["2.4.12"]
}
"commands" : {
"WriteDemoToFile" : {
"command" : "echo
"Demo" > test.txt"
}
}
}
}
instancestackAWS
CloudFormation
Completing instance configuration: using
waitCondition
"Resources" : {
"WaitCondition" : {
"Type" : "AWS::CloudFormation::WaitCondition",
"DependsOn" : "WebServer",
"Properties" : {
"Handle" : {"Ref" : "WaitHandle"},
"Timeout" : "600"
}
},
"WebServer": {
"Type": "AWS::EC2::Instance",
"Metadata" : {
"UserData" : {
"/opt/aws/bin/cfn-signal –success <waitconditionhandle>"
}
}
• A separate resource
Completing instance configuration: using
WaitCondition
Instance A
stackAWS
CloudFormation
Instance B
Completing instance configuration: using
WaitCondition
WaitCondition
Resource
"Count": "2"
Instance A
stackAWS
CloudFormation
Instance B
#> cfn-signal
–-success <URL>
#> cfn-signal
–-success <URL>
Completing instance configuration: using
WaitCondition
WaitCondition
Resource
"Count": "2"
Instance A
stackAWS
CloudFormation
Instance B
#> cfn-signal
–-success <URL>
Send
Completion signal
#> cfn-signal
–-success <URL>
Create Templates from your environment with CloudFormer
The love story so far...
The love story so far...
• Repeatable deployments
Versioning your infrastructure
Users
Web Server RDS Database
security group security groupRoute 53
Versioning your infrastructure
Users
Web Server RDS Database
security group security groupRoute 53
• Modify existing template
• Or create a new one
– Ensure all resources are present
• Infrastructure as Code:
– Store in version control
– Store with your code
– Git, Subversion, etc
Update your template, apply it to the stack
"Resources" : {
"BrandNewDNSrecord" : {
"Type" : "AWS::Route53::RecordSet",
"Properties" : {
"Comment" : "Demo for Summit 2015",
"HostedZoneId" : "ABC123BUZZY",
"Name" : "summit.buzzy.geek.nz.",
"TTL" : "60",
"Type" : "A"
}
}
}
Controlling stack updates: Resource updates
Controlling stack updates: Resource updates
• Prevent updates to
resources within the stack
• Explicitly override during
updates
– A temporary change of policy
Controlling stack updates: stack policies
{
"Statement" : [
{
"Effect" : "Deny",
"Action" : "Update:*",
"Principal": "*",
"Resource" : "*"
}
]
}
Updating a stack where Resource properties require
replacement
Updating a stack where Resource properties require
replacement
Updating a stack where Resource properties require
replacement
Controlling stack deletion: DeletionPolicy
"Resources" : {
"myS3Bucket" : {
"Type" : "AWS::S3::Bucket",
"DeletionPolicy" : "Retain"
}
}
Demo 1
The love story so far...
The love story so far...
• Repeatable deployments
• Versioned Infrastructure as code
Deploying different environments
• Multiple similar environments
– Production
– Test, Development
– Multiple AWS regions
• Avoid becoming a template factory
– Fewer, more adaptable templates
Example: Production or Dev?
stack
Auto Scaling
stack
Elastic Load

Balancing
template
Prod
Dev
Web Server
security group
RDS Database
security group security group
Instances
RDS Database
security group
• A parameter to specify
the kind of stack
Parameters and Conditions
"Parameters" : {
"EnvironmentType" : {
"Description" : "Production or Development environment",
"AllowedValues" : [ "Prod", "Dev" ],
"ConstraintDescription" : "Must be Prod or Dev"
}
"Conditions" : {
"UseProdCondition" : {
"Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Prod"]
},
"UseDevCondition" : {
"Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Dev"]
}
"Resources": {
"WebServer": {
"Type": "AWS::EC2::Instance",
"Condition": "useDevCondition",
},
• A parameter to specify
the kind of stack
• Conditions that will be
evaluated
Parameters and Conditions
"Parameters" : {
"EnvironmentType" : {
"Description" : "Production or Development environment",
"AllowedValues" : [ "Prod", "Dev" ],
"ConstraintDescription" : "Must be Prod or Dev"
}
"Conditions" : {
"UseProdCondition" : {
"Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Prod"]
},
"UseDevCondition" : {
"Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Dev"]
}
"Resources": {
"WebServer": {
"Type": "AWS::EC2::Instance",
"Condition": "UseDevCondition",
},
• A parameter to specify
the kind of stack
• Conditions that will be
evaluated
• Determines whether a
resource or property
should be created
Parameters and Conditions
"Parameters" : {
"EnvironmentType" : {
"Description" : "Production or Development environment",
"AllowedValues" : [ "Prod", "Dev" ],
"ConstraintDescription" : "Must be Prod or Dev"
}
"Conditions" : {
"UseProdCondition" : {
"Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Prod"]
},
"UseDevCondition" : {
"Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Dev"]
}
"Resources": {
"WebServer": {
"Type": "AWS::EC2::Instance",
"Condition": "UseDevCondition",
},
Example: Production or Dev?
stack
Auto Scaling
stack
Elastic Load

Balancing
template
Web Server
security group
RDS Database
security group security group
Instances
Parameter:
Prod or Dev
RDS Database
security group
• Logic about how a
resource will be created
Mappings
"Parameters" : {
"EnvironmentType" : {
"Description" : "Production or Development environment",
"AllowedValues" : [ "Prod", "Dev" ],
"ConstraintDescription" : "Must be Prod or Dev"
},
"Mappings" : {
"SourceAMI" : {
"Prod" : { "ap-southeast-1" : "ami-d34db33f", "us-east-1" : "ami-12345678" },
"Dev" : { "ap-southeast-1" : "ami-d5f8fc0d", "us-east-1" : "ami-b6c63d8f" }
}
}
"Resources": {
"WebServer": {
"ImageID" : { "Fn::FindInMap" : [ "SourceAMI", { "Ref" : "EnvironmentType" },
{ "Ref" : "AWS::Region" ] }
• A mapping consists of two-
level key:value pairs
Mappings
"Parameters" : {
"EnvironmentType" : {
"Description" : "Production or Development environment",
"AllowedValues" : [ "Prod", "Dev" ],
"ConstraintDescription" : "Must be Prod or Dev"
},
"Mappings" : {
"SourceAMI" : {
"Prod" : { "ap-southeast-1" : "ami-d34db33f", "us-east-1" : "ami-12345678" },
"Dev" : { "ap-southeast-1" : "ami-d5f8fc0d", "us-east-1" : "ami-b6c63d8f" }
}
}
"Resources": {
"WebServer": {
"ImageID" : { "Fn::FindInMap" : [ "SourceAMI", { "Ref" : "EnvironmentType" }, {
"Ref" : "AWS::Region" ] }
Looking up the mapping
"Parameters" : {
"EnvironmentType" : {
"Description" : "Production or Development environment",
"AllowedValues" : [ "Prod", "Dev" ],
"ConstraintDescription" : "Must be Prod or Dev"
},
"Mappings" : {
"SourceAMI" : {
"Prod" : { "ap-southeast-1" : "ami-d34db33f", "us-east-1" : "ami-12345678" },
"Dev" : { "ap-southeast-1" : "ami-d5f8fc0d", "us-east-1" : "ami-b6c63d8f" }
}
}
"Resources": {
"WebServer": {
"ImageID" : { "Fn::FindInMap" : [ "SourceAMI", { "Ref" : "EnvironmentType" },
{ "Ref" : "AWS::Region" ] }
• Referenced by a property
Demo 2
The love story so far...
The love story so far...
• Repeatable deployments
• Versioned Infrastructure as code
• Use-case specific deployments
Expanding your use of CloudFormation: 

Working with multiple templates
• An inevitability as you grow
– Stack limits (60 outputs, 200 resources, 51200 bytes)
– Segregation of duties
– Velocity of change
• Layers of stacks
– Identity
– Network
– Shared services
– Back end services
– Front end services
Nested stacks
stack
stack
template Amazon VPC
Auto Scaling
Elastic Load

Balancing
RDS Database
security group security group
Instances
Chaining stacks together
stacktemplate
”Outputs" : {
”VPCInfo" : {
”VPCName” : {
”Fn::GetAtt" :
{ ”VPC:Name”}
}
»VPCid" : {
”Fn::GetAtt" :
{ ”VPC::ID” }
}
}
Outputs
Amazon VPC
Chaining stacks together
stacktemplate
”Outputs" : {
”VPCInfo" : {
”VPCName” : {
”Fn::GetAtt" :
{ ”VPC:Name”}
}
»VPCid" : {
”Fn::GetAtt" :
{ ”VPC::ID” }
}
}
Outputs
#> DeployComputeStack.rb
Amazon VPC
Chaining stacks together
stack
stack
template
”Outputs" : {
”VPCInfo" : {
”VPCName” : {
”Fn::GetAtt" :
{ ”VPC:Name”}
}
»VPCid" : {
”Fn::GetAtt" :
{ ”VPC::ID” }
}
}
Outputs
#> DeployComputeStack.rb
Amazon VPC
Auto Scaling
Elastic Load

Balancing
security group
Instances
The love story so far...
The love story so far...
• Repeatable deployments
• Versioned Infrastructure as code
• Use-case specific deployments
• Management at scale
Hi!	
  I’m	
  Ben	
  Salt.
Senior	
  Solutions	
  Architect,
Platform	
  Services	
  Team,	
  Xero.
Xero
Leading small business cloud platform
Vision
Millions of people all over the
world love doing business on
Xero
Mission
Grow prosperity by connecting
people through beautifully
designed business software
Goal
Achieving scale and value by
winning one million+ customers
Technology at Xero
• Mostly a Microsoft shop
– Big SQL Server user
– Lots of .NET web applications

• Linux is used for some functionality
– Redis
– Cassandra
– Elastic Search
Our Journey – In the beginning
Our Journey – Introducing CloudFormation
• Started Small
– A single template
– Provisioned a VPC, Subnets, Internet Gateway, NAT instance
and Windows box!
• Then – we added more...
– Added some more network configuration
– Provisioned some more Windows boxes
Our Journey – Introducing CloudFormation
• But, we ran into some problems
– There is a file size limit – 460,800 bytes
– JSON syntax validation
– Lots of changes, engineers starting to overwrite each other
– Other limits, in particular
• 60 parameters
• 60 outputs
Our Journey – Tooling
• JSON Syntax Validation
– We wrote a Powershell JSON validation script
– Recently expanded it validate parameters
• Source Control
– Placed CloudFormation scripts in Source Control
– Wrote a “Sync to S3” script
• Visual Studio
– Helped with syntax
– AWS Tools for Visual Studio are a must!
Our Journey – Nested Stacks
• To get around the file size and parameter issue:
– Split the stack into a number of components
– AWS::CloudFormation::Stack
– Parameters made parts of the stack reusable
• VPC Formation
• Web Server Provisioning
Our Journey – Fun with Parameters
• String
• Number
• List<Number>
• CommaDelimitedList
• AWS::EC2::KeyPair::KeyName
• AWS::EC2::SecurityGroup::Id
• AWS::EC2::VPC::Id
• List<AWS::EC2::VPC::Id>
• List<AWS::EC2::SecurityGroup::Id>
• List<AWS::EC2::Subnet::Id>
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
Our Journey – Fun with Parameters
"Parameters" : {
"ipProxyPublic1" : {
"Description" : "Public IP Address for Proxy1",
"Type" : "String”
},
"SecurityGroupForProxy" : {
"Description" : "Comma Delimited String of Security Groups...”,
"Type" : "List<AWS::EC2::SecurityGroup::Id>”
}
}
Our Journey – Fun with Parameters
"DeployProxy": {
"Type" : "AWS::CloudFormation::Stack”,
"Properties" : {
"TemplateURL" : "proxy.template",
"Parameters" : {
"ipProxyPublic1" :
{ "Fn::GetAtt" : [ "CreateElasticIPs", "Outputs.eipProxyPublicAddress1" ] },
"SecurityGroupForProxy" :
{"Fn::Join" : [ ",",
[ { "Fn::GetAtt" : [ "CreateSecurityGroups", "Outputs.sgAllowELBAccess" ] },
{ "Fn::GetAtt" : [ "CreateSecurityGroups", "Outputs.sgManagementAccess"] }
]]}
}
}
}
Our Journey – What we ended up with
Main Stack
DeployNetwork
>DeployVPC1
>DeployVPC2
>DeployVPC3
VPCPeering
>DeploySubnetsforVPC1
>DeploySubnetsforVPC2
>DeploySubnetsforVPC3
DeployCoreInfrastructure
CreateElasticIPs
>CreateSecurityGroups
>DeployProxy
>FirstDomainController
>SubsequentDomainController
>FirstDNSServer
>SubsequentDNSServer
>RemoteDesktopServers
DeployApplicationStack
...
Our Journey – Nested Stacks
Our Journey – What’s Next?
• CI / CD
– Automates the creation and updates of the stack
• Decomposing the Nested Stack
– Let CI assist with the orchestration
• Implement an Infrastructure Testing Framework
– Infrastructure as code is great – but how do you test it?
OpsWorks
OpsWorks: model your application
OpsWorks lifecycle events
setup configure deploy undeploy shutdown
Chef recipe
+
Metadata
=
Command
execute "mysql-connect" do
command "/usr/bin/mysql
-u#{node[:deploy][:myphpapp][:database][:username]}
-p#{node[:deploy][:myphpapp][:database][:password]}
#{node[:deploy][:myphpapp][:database][:database]}
…
"deploy": {
"myphpapp": {
"database": {
"username": "root",
"password": "abcxyz",
…
"/usr/bin/mysql -uroot –pabcxyz myphpapp …
Configure with Chef recipes
Setup Configure Deploy Execute recipes Shutdown
Attach recipes to events
App Server
Setup Configure Deploy Execute recipes Shutdown
Attach recipes to events
Setup Configure Deploy
App Server
RDS Database
Setup Configure Deploy Execute recipes Shutdown
Attach recipes to events
Setup Configure Deploy
Setup Configure
App Server
RDS Database
Setup Configure Deploy Execute recipes Shutdown
Attach recipes to events
Setup Configure Deploy
Setup Configure
Configure
App Server
RDS Database
Setup Configure Deploy Execute recipes Shutdown
App Server
Attach recipes to events
Setup Configure Deploy
Setup Configure
Configure
App Server
RDS Database
Setup Configure Deploy Execute recipes Shutdown
App Server
Attach recipes to events
Setup Configure Deploy
Change
permissions
Setup Configure
Configure
• OpsWorks items as
CloudFormation resources
• Automate deployment with
CloudFormation
• Automate "Day 2"
management tasks with
OpsWorks
Combining OpsWorks and CloudFormation
"Resources" : {
"WordPressStack" : {
"Type" : "AWS::OpsWorks::Stack",
"Properties" : {
"Name" : "MyWordPressStack",
"ServiceRoleArn" : "arn:aws:iam::0123456789:role/service-role",
"DefaultSshKeyName" : {"Ref":"KeyName"}
}
},
"myLayer": {
"Type": "AWS::OpsWorks::Layer",
"Properties": {
"StackId": {"Ref": "WordPressStack"},
"Name": "PHP App Server",
"Type": "php-app"
}
}
The love story so far...
The love story so far...
• Repeatable deployments
• Versioned Infrastructure as code
• Use-case specific deployments
• Management at scale
• Application automation
Next steps
• Get the templates used in this session:
http://s3.buzzy.geek.nz/summit2015
• Experiment!
Automating your Infrastructure Deployment with AWS CloudFormation and AWS OpsWorks

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
 
Azure Active Directory - An Introduction
Azure Active Directory  - An IntroductionAzure Active Directory  - An Introduction
Azure Active Directory - An Introduction
 
Serverless Web Apps using API Gateway, Lambda and DynamoDB
Serverless Web Apps using API Gateway, Lambda and DynamoDBServerless Web Apps using API Gateway, Lambda and DynamoDB
Serverless Web Apps using API Gateway, Lambda and DynamoDB
 
DevOps on AWS
DevOps on AWSDevOps on AWS
DevOps on AWS
 
AWS Cloud Security
AWS Cloud SecurityAWS Cloud Security
AWS Cloud Security
 
AWS Security Strategy
AWS Security StrategyAWS Security Strategy
AWS Security Strategy
 
Building secure applications with keycloak
Building secure applications with keycloak Building secure applications with keycloak
Building secure applications with keycloak
 
OpenId Connect Protocol
OpenId Connect ProtocolOpenId Connect Protocol
OpenId Connect Protocol
 
Introduction to OpenID Connect
Introduction to OpenID Connect Introduction to OpenID Connect
Introduction to OpenID Connect
 
Architecting for AWS
Architecting for AWSArchitecting for AWS
Architecting for AWS
 
Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...
Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...
Access Control for the Cloud: AWS Identity and Access Management (IAM) (SEC20...
 
Introduction to SAML 2.0
Introduction to SAML 2.0Introduction to SAML 2.0
Introduction to SAML 2.0
 
Introduction to Microsoft Azure 101
Introduction to Microsoft Azure 101Introduction to Microsoft Azure 101
Introduction to Microsoft Azure 101
 
Introduction to AWS Storage Services
Introduction to AWS Storage ServicesIntroduction to AWS Storage Services
Introduction to AWS Storage Services
 
AWS Data Transfer Services Deep Dive
AWS Data Transfer Services Deep Dive AWS Data Transfer Services Deep Dive
AWS Data Transfer Services Deep Dive
 
AWS Cloud Security Fundamentals
AWS Cloud Security FundamentalsAWS Cloud Security Fundamentals
AWS Cloud Security Fundamentals
 
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
 
Microsoft Azure Overview
Microsoft Azure OverviewMicrosoft Azure Overview
Microsoft Azure Overview
 
Working with Terraform on Azure
Working with Terraform on AzureWorking with Terraform on Azure
Working with Terraform on Azure
 
Introduction of AWS KMS
Introduction of AWS KMSIntroduction of AWS KMS
Introduction of AWS KMS
 

Andere mochten auch

Andere mochten auch (20)

AWS CloudFormation Masterclass
AWS CloudFormation MasterclassAWS CloudFormation Masterclass
AWS CloudFormation Masterclass
 
(DVO304) AWS CloudFormation Best Practices
(DVO304) AWS CloudFormation Best Practices(DVO304) AWS CloudFormation Best Practices
(DVO304) AWS CloudFormation Best Practices
 
Infrastructure Automation on AWS using a Real-World Customer Example - Sessio...
Infrastructure Automation on AWS using a Real-World Customer Example - Sessio...Infrastructure Automation on AWS using a Real-World Customer Example - Sessio...
Infrastructure Automation on AWS using a Real-World Customer Example - Sessio...
 
AWS CloudFormation Best Practices
AWS CloudFormation Best PracticesAWS CloudFormation Best Practices
AWS CloudFormation Best Practices
 
Masterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormationMasterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormation
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Continuous Deployment Practices, with Production, Test and Development Enviro...
Continuous Deployment Practices, with Production, Test and Development Enviro...Continuous Deployment Practices, with Production, Test and Development Enviro...
Continuous Deployment Practices, with Production, Test and Development Enviro...
 
(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS(DVO401) Deep Dive into Blue/Green Deployments on AWS
(DVO401) Deep Dive into Blue/Green Deployments on AWS
 
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
(APP306) Using AWS CloudFormation for Deployment and Management at Scale | AW...
 
Deep Dive: AWS CloudFormation
Deep Dive: AWS CloudFormationDeep Dive: AWS CloudFormation
Deep Dive: AWS CloudFormation
 
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
 
Infrastructure Continuous Delivery Using AWS CloudFormation
Infrastructure Continuous Delivery Using AWS CloudFormationInfrastructure Continuous Delivery Using AWS CloudFormation
Infrastructure Continuous Delivery Using AWS CloudFormation
 
Deep Dive - Amazon Virtual Private Cloud (VPC)
Deep Dive - Amazon Virtual Private Cloud (VPC)Deep Dive - Amazon Virtual Private Cloud (VPC)
Deep Dive - Amazon Virtual Private Cloud (VPC)
 
AWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment ComplexityAWS CodeDeploy: Manage Deployment Complexity
AWS CodeDeploy: Manage Deployment Complexity
 
Financial Programmer - How to break into investment banks for java developers
Financial Programmer - How to break into investment banks for java developersFinancial Programmer - How to break into investment banks for java developers
Financial Programmer - How to break into investment banks for java developers
 
Building Automated Control Systems for Your AWS Infrastructure
Building Automated Control Systems for Your AWS InfrastructureBuilding Automated Control Systems for Your AWS Infrastructure
Building Automated Control Systems for Your AWS Infrastructure
 
Microservices
MicroservicesMicroservices
Microservices
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Perl and Elasticsearch
Perl and ElasticsearchPerl and Elasticsearch
Perl and Elasticsearch
 
Hadoop For Enterprises
Hadoop For EnterprisesHadoop For Enterprises
Hadoop For Enterprises
 

Ähnlich wie Automating your Infrastructure Deployment with AWS CloudFormation and AWS OpsWorks

Scalable and Fault-Tolerant Apps with AWS
Scalable and Fault-Tolerant Apps with AWSScalable and Fault-Tolerant Apps with AWS
Scalable and Fault-Tolerant Apps with AWS
Fernando Rodriguez
 

Ähnlich wie Automating your Infrastructure Deployment with AWS CloudFormation and AWS OpsWorks (20)

Automating your Infrastructure Deployment with CloudFormation and OpsWorks –...
 Automating your Infrastructure Deployment with CloudFormation and OpsWorks –... Automating your Infrastructure Deployment with CloudFormation and OpsWorks –...
Automating your Infrastructure Deployment with CloudFormation and OpsWorks –...
 
Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as Code
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
AWS May Webinar Series - Deep Dive: Infrastructure as Code
AWS May Webinar Series - Deep Dive: Infrastructure as CodeAWS May Webinar Series - Deep Dive: Infrastructure as Code
AWS May Webinar Series - Deep Dive: Infrastructure as Code
 
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office Hours
 
Managing the Life Cycle of IT Products
Managing the Life Cycle of IT ProductsManaging the Life Cycle of IT Products
Managing the Life Cycle of IT Products
 
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel AvivSelf Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
Self Service Agile Infrastructure for Product Teams - Pop-up Loft Tel Aviv
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
 
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
 
AWS Infrastructure as Code - September 2016 Webinar Series
AWS Infrastructure as Code - September 2016 Webinar SeriesAWS Infrastructure as Code - September 2016 Webinar Series
AWS Infrastructure as Code - September 2016 Webinar Series
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
 
Automating Security in your IaC Pipeline
Automating Security in your IaC PipelineAutomating Security in your IaC Pipeline
Automating Security in your IaC Pipeline
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Scalable and Fault-Tolerant Apps with AWS
Scalable and Fault-Tolerant Apps with AWSScalable and Fault-Tolerant Apps with AWS
Scalable and Fault-Tolerant Apps with AWS
 
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
Managing Your Infrastructure as Code by Travis Williams, Solutions Architect,...
 
Managing Your Infrastructure as Code
Managing Your Infrastructure as CodeManaging Your Infrastructure as Code
Managing Your Infrastructure as Code
 
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
Zero to Sixty: AWS CloudFormation (DMG201) | AWS re:Invent 2013
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

Automating your Infrastructure Deployment with AWS CloudFormation and AWS OpsWorks

  • 1. Automating your infrastructure deployment with CloudFormation and OpsWorks Richard Busby, Solutions Architect Amazon Web Services
  • 2. Business 101 Technical 201 Technical 301 Technical 401 Technical Session Grading
  • 3. • Repeatable deployments • Versioned Infrastructure as code • Use-case specific deployments • Management at scale • Application automation Why treat your infrastructure as code?
  • 4. • Repeatable deployments • Versioned Infrastructure as code • Use-case specific deployments • Management at scale • Application automation A love story
  • 5. A Simple Wordpress deployment with CloudFormation Users Web Server RDS Database security group security group
  • 6. Automating instance configuration: using cfn-init "Resources" : { "WebServer": { "Type": "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } }, "UserData" : { "/opt/aws/bin/cfn-init -s<stackID> -r<ResourceID> --region <Region>" } • Packages • Groups • Users • Sources • Files • Commands • Services
  • 7. Automating instance configuration: using cfn-init "Resources" : { "WebServer": { "Type": "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } }, "UserData" : { "/opt/aws/bin/cfn-init -s<stackID> -r<ResourceID> --region <Region>" } • Packages • Groups • Users • Sources • Files • Commands • Services
  • 8. Automating instance configuration: using cfn-init "Resources" : { "WebServer": { "Type": "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } }, "UserData" : { "/opt/aws/bin/cfn-init -s<stackID> -r<ResourceID> --region <Region>" } • Packages • Groups • Users • Sources • Files • Commands • Services
  • 9. How cfn-init works instancestack "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } } } AWS CloudFormation
  • 10. How cfn-init works instancestack #> cfn-init -–stack <stackname> --resource <resourcename> "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } } } AWS CloudFormation
  • 11. How cfn-init works instancestack #> cfn-init -–stack <stackname> --resource <resourcename> "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } } } Get metadata, perform actions AWS CloudFormation
  • 12. Signalling instance configuration: using creationPolicy "Resources" : { "WebServer": { "Type": "AWS::EC2::Instance", "CreationPolicy": { "ResourceSignal": { "Count": "1", "Timeout": "PT15M" } } }, "Metadata" : { "UserData" : { "/opt/aws/bin/cfn-signal –-stack <stackID> --resource <ResourceID> --success" } } • Property of an EC2 instance or Auto Scaling Group • Inform CloudFormation when configuration is complete
  • 13. Signalling instance configuration: using creationPolicy "Resources" : { "WebServer": { "Type": "AWS::EC2::Instance", "CreationPolicy": { "ResourceSignal": { "Count": "1", "Timeout": "PT15M" } } }, "Metadata" : { "UserData" : { "/opt/aws/bin/cfn-signal –-stack <stackID> --resource <ResourceID> --success" } } • Property of an EC2 instance or Auto Scaling Group • Inform CloudFormation when configuration is complete
  • 14. How creationPolicy works "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } } } instancestackAWS CloudFormation
  • 15. How creationPolicy works #> cfn-signal --success --stack <stackname> --resource <resourcename> "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } } } instancestackAWS CloudFormation
  • 16. How creationPolicy works #> cfn-signal --success --stack <stackname> --resource <resourcename> Send completion signal "AWS::CloudFormation::Init" : { "config" : { "packages" : { "httpd" : ["2.4.12"] } "commands" : { "WriteDemoToFile" : { "command" : "echo "Demo" > test.txt" } } } } instancestackAWS CloudFormation
  • 17. Completing instance configuration: using waitCondition "Resources" : { "WaitCondition" : { "Type" : "AWS::CloudFormation::WaitCondition", "DependsOn" : "WebServer", "Properties" : { "Handle" : {"Ref" : "WaitHandle"}, "Timeout" : "600" } }, "WebServer": { "Type": "AWS::EC2::Instance", "Metadata" : { "UserData" : { "/opt/aws/bin/cfn-signal –success <waitconditionhandle>" } } • A separate resource
  • 18. Completing instance configuration: using WaitCondition Instance A stackAWS CloudFormation Instance B
  • 19. Completing instance configuration: using WaitCondition WaitCondition Resource "Count": "2" Instance A stackAWS CloudFormation Instance B #> cfn-signal –-success <URL> #> cfn-signal –-success <URL>
  • 20. Completing instance configuration: using WaitCondition WaitCondition Resource "Count": "2" Instance A stackAWS CloudFormation Instance B #> cfn-signal –-success <URL> Send Completion signal #> cfn-signal –-success <URL>
  • 21. Create Templates from your environment with CloudFormer
  • 22. The love story so far...
  • 23. The love story so far... • Repeatable deployments
  • 24. Versioning your infrastructure Users Web Server RDS Database security group security groupRoute 53
  • 25. Versioning your infrastructure Users Web Server RDS Database security group security groupRoute 53
  • 26. • Modify existing template • Or create a new one – Ensure all resources are present • Infrastructure as Code: – Store in version control – Store with your code – Git, Subversion, etc Update your template, apply it to the stack "Resources" : { "BrandNewDNSrecord" : { "Type" : "AWS::Route53::RecordSet", "Properties" : { "Comment" : "Demo for Summit 2015", "HostedZoneId" : "ABC123BUZZY", "Name" : "summit.buzzy.geek.nz.", "TTL" : "60", "Type" : "A" } } }
  • 27. Controlling stack updates: Resource updates
  • 28. Controlling stack updates: Resource updates
  • 29. • Prevent updates to resources within the stack • Explicitly override during updates – A temporary change of policy Controlling stack updates: stack policies { "Statement" : [ { "Effect" : "Deny", "Action" : "Update:*", "Principal": "*", "Resource" : "*" } ] }
  • 30. Updating a stack where Resource properties require replacement
  • 31. Updating a stack where Resource properties require replacement
  • 32. Updating a stack where Resource properties require replacement
  • 33. Controlling stack deletion: DeletionPolicy "Resources" : { "myS3Bucket" : { "Type" : "AWS::S3::Bucket", "DeletionPolicy" : "Retain" } }
  • 35. The love story so far...
  • 36. The love story so far... • Repeatable deployments • Versioned Infrastructure as code
  • 37. Deploying different environments • Multiple similar environments – Production – Test, Development – Multiple AWS regions • Avoid becoming a template factory – Fewer, more adaptable templates
  • 38. Example: Production or Dev? stack Auto Scaling stack Elastic Load Balancing template Prod Dev Web Server security group RDS Database security group security group Instances RDS Database security group
  • 39. • A parameter to specify the kind of stack Parameters and Conditions "Parameters" : { "EnvironmentType" : { "Description" : "Production or Development environment", "AllowedValues" : [ "Prod", "Dev" ], "ConstraintDescription" : "Must be Prod or Dev" } "Conditions" : { "UseProdCondition" : { "Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Prod"] }, "UseDevCondition" : { "Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Dev"] } "Resources": { "WebServer": { "Type": "AWS::EC2::Instance", "Condition": "useDevCondition", },
  • 40. • A parameter to specify the kind of stack • Conditions that will be evaluated Parameters and Conditions "Parameters" : { "EnvironmentType" : { "Description" : "Production or Development environment", "AllowedValues" : [ "Prod", "Dev" ], "ConstraintDescription" : "Must be Prod or Dev" } "Conditions" : { "UseProdCondition" : { "Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Prod"] }, "UseDevCondition" : { "Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Dev"] } "Resources": { "WebServer": { "Type": "AWS::EC2::Instance", "Condition": "UseDevCondition", },
  • 41. • A parameter to specify the kind of stack • Conditions that will be evaluated • Determines whether a resource or property should be created Parameters and Conditions "Parameters" : { "EnvironmentType" : { "Description" : "Production or Development environment", "AllowedValues" : [ "Prod", "Dev" ], "ConstraintDescription" : "Must be Prod or Dev" } "Conditions" : { "UseProdCondition" : { "Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Prod"] }, "UseDevCondition" : { "Fn::Equals" : [{"Ref" : "EnvironmentType"}, "Dev"] } "Resources": { "WebServer": { "Type": "AWS::EC2::Instance", "Condition": "UseDevCondition", },
  • 42. Example: Production or Dev? stack Auto Scaling stack Elastic Load Balancing template Web Server security group RDS Database security group security group Instances Parameter: Prod or Dev RDS Database security group
  • 43. • Logic about how a resource will be created Mappings "Parameters" : { "EnvironmentType" : { "Description" : "Production or Development environment", "AllowedValues" : [ "Prod", "Dev" ], "ConstraintDescription" : "Must be Prod or Dev" }, "Mappings" : { "SourceAMI" : { "Prod" : { "ap-southeast-1" : "ami-d34db33f", "us-east-1" : "ami-12345678" }, "Dev" : { "ap-southeast-1" : "ami-d5f8fc0d", "us-east-1" : "ami-b6c63d8f" } } } "Resources": { "WebServer": { "ImageID" : { "Fn::FindInMap" : [ "SourceAMI", { "Ref" : "EnvironmentType" }, { "Ref" : "AWS::Region" ] }
  • 44. • A mapping consists of two- level key:value pairs Mappings "Parameters" : { "EnvironmentType" : { "Description" : "Production or Development environment", "AllowedValues" : [ "Prod", "Dev" ], "ConstraintDescription" : "Must be Prod or Dev" }, "Mappings" : { "SourceAMI" : { "Prod" : { "ap-southeast-1" : "ami-d34db33f", "us-east-1" : "ami-12345678" }, "Dev" : { "ap-southeast-1" : "ami-d5f8fc0d", "us-east-1" : "ami-b6c63d8f" } } } "Resources": { "WebServer": { "ImageID" : { "Fn::FindInMap" : [ "SourceAMI", { "Ref" : "EnvironmentType" }, { "Ref" : "AWS::Region" ] }
  • 45. Looking up the mapping "Parameters" : { "EnvironmentType" : { "Description" : "Production or Development environment", "AllowedValues" : [ "Prod", "Dev" ], "ConstraintDescription" : "Must be Prod or Dev" }, "Mappings" : { "SourceAMI" : { "Prod" : { "ap-southeast-1" : "ami-d34db33f", "us-east-1" : "ami-12345678" }, "Dev" : { "ap-southeast-1" : "ami-d5f8fc0d", "us-east-1" : "ami-b6c63d8f" } } } "Resources": { "WebServer": { "ImageID" : { "Fn::FindInMap" : [ "SourceAMI", { "Ref" : "EnvironmentType" }, { "Ref" : "AWS::Region" ] } • Referenced by a property
  • 47. The love story so far...
  • 48. The love story so far... • Repeatable deployments • Versioned Infrastructure as code • Use-case specific deployments
  • 49. Expanding your use of CloudFormation: 
 Working with multiple templates • An inevitability as you grow – Stack limits (60 outputs, 200 resources, 51200 bytes) – Segregation of duties – Velocity of change • Layers of stacks – Identity – Network – Shared services – Back end services – Front end services
  • 50. Nested stacks stack stack template Amazon VPC Auto Scaling Elastic Load Balancing RDS Database security group security group Instances
  • 51. Chaining stacks together stacktemplate ”Outputs" : { ”VPCInfo" : { ”VPCName” : { ”Fn::GetAtt" : { ”VPC:Name”} } »VPCid" : { ”Fn::GetAtt" : { ”VPC::ID” } } } Outputs Amazon VPC
  • 52. Chaining stacks together stacktemplate ”Outputs" : { ”VPCInfo" : { ”VPCName” : { ”Fn::GetAtt" : { ”VPC:Name”} } »VPCid" : { ”Fn::GetAtt" : { ”VPC::ID” } } } Outputs #> DeployComputeStack.rb Amazon VPC
  • 53. Chaining stacks together stack stack template ”Outputs" : { ”VPCInfo" : { ”VPCName” : { ”Fn::GetAtt" : { ”VPC:Name”} } »VPCid" : { ”Fn::GetAtt" : { ”VPC::ID” } } } Outputs #> DeployComputeStack.rb Amazon VPC Auto Scaling Elastic Load Balancing security group Instances
  • 54. The love story so far...
  • 55. The love story so far... • Repeatable deployments • Versioned Infrastructure as code • Use-case specific deployments • Management at scale
  • 56. Hi!  I’m  Ben  Salt. Senior  Solutions  Architect, Platform  Services  Team,  Xero.
  • 57. Xero Leading small business cloud platform Vision Millions of people all over the world love doing business on Xero Mission Grow prosperity by connecting people through beautifully designed business software Goal Achieving scale and value by winning one million+ customers
  • 58. Technology at Xero • Mostly a Microsoft shop – Big SQL Server user – Lots of .NET web applications
 • Linux is used for some functionality – Redis – Cassandra – Elastic Search
  • 59. Our Journey – In the beginning
  • 60. Our Journey – Introducing CloudFormation • Started Small – A single template – Provisioned a VPC, Subnets, Internet Gateway, NAT instance and Windows box! • Then – we added more... – Added some more network configuration – Provisioned some more Windows boxes
  • 61. Our Journey – Introducing CloudFormation • But, we ran into some problems – There is a file size limit – 460,800 bytes – JSON syntax validation – Lots of changes, engineers starting to overwrite each other – Other limits, in particular • 60 parameters • 60 outputs
  • 62. Our Journey – Tooling • JSON Syntax Validation – We wrote a Powershell JSON validation script – Recently expanded it validate parameters • Source Control – Placed CloudFormation scripts in Source Control – Wrote a “Sync to S3” script • Visual Studio – Helped with syntax – AWS Tools for Visual Studio are a must!
  • 63. Our Journey – Nested Stacks • To get around the file size and parameter issue: – Split the stack into a number of components – AWS::CloudFormation::Stack – Parameters made parts of the stack reusable • VPC Formation • Web Server Provisioning
  • 64. Our Journey – Fun with Parameters • String • Number • List<Number> • CommaDelimitedList • AWS::EC2::KeyPair::KeyName • AWS::EC2::SecurityGroup::Id • AWS::EC2::VPC::Id • List<AWS::EC2::VPC::Id> • List<AWS::EC2::SecurityGroup::Id> • List<AWS::EC2::Subnet::Id> http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
  • 65. Our Journey – Fun with Parameters "Parameters" : { "ipProxyPublic1" : { "Description" : "Public IP Address for Proxy1", "Type" : "String” }, "SecurityGroupForProxy" : { "Description" : "Comma Delimited String of Security Groups...”, "Type" : "List<AWS::EC2::SecurityGroup::Id>” } }
  • 66. Our Journey – Fun with Parameters "DeployProxy": { "Type" : "AWS::CloudFormation::Stack”, "Properties" : { "TemplateURL" : "proxy.template", "Parameters" : { "ipProxyPublic1" : { "Fn::GetAtt" : [ "CreateElasticIPs", "Outputs.eipProxyPublicAddress1" ] }, "SecurityGroupForProxy" : {"Fn::Join" : [ ",", [ { "Fn::GetAtt" : [ "CreateSecurityGroups", "Outputs.sgAllowELBAccess" ] }, { "Fn::GetAtt" : [ "CreateSecurityGroups", "Outputs.sgManagementAccess"] } ]]} } } }
  • 67. Our Journey – What we ended up with Main Stack DeployNetwork >DeployVPC1 >DeployVPC2 >DeployVPC3 VPCPeering >DeploySubnetsforVPC1 >DeploySubnetsforVPC2 >DeploySubnetsforVPC3 DeployCoreInfrastructure CreateElasticIPs >CreateSecurityGroups >DeployProxy >FirstDomainController >SubsequentDomainController >FirstDNSServer >SubsequentDNSServer >RemoteDesktopServers DeployApplicationStack ...
  • 68. Our Journey – Nested Stacks
  • 69. Our Journey – What’s Next? • CI / CD – Automates the creation and updates of the stack • Decomposing the Nested Stack – Let CI assist with the orchestration • Implement an Infrastructure Testing Framework – Infrastructure as code is great – but how do you test it?
  • 71. OpsWorks: model your application
  • 72. OpsWorks lifecycle events setup configure deploy undeploy shutdown
  • 73. Chef recipe + Metadata = Command execute "mysql-connect" do command "/usr/bin/mysql -u#{node[:deploy][:myphpapp][:database][:username]} -p#{node[:deploy][:myphpapp][:database][:password]} #{node[:deploy][:myphpapp][:database][:database]} … "deploy": { "myphpapp": { "database": { "username": "root", "password": "abcxyz", … "/usr/bin/mysql -uroot –pabcxyz myphpapp … Configure with Chef recipes
  • 74. Setup Configure Deploy Execute recipes Shutdown Attach recipes to events
  • 75. App Server Setup Configure Deploy Execute recipes Shutdown Attach recipes to events Setup Configure Deploy
  • 76. App Server RDS Database Setup Configure Deploy Execute recipes Shutdown Attach recipes to events Setup Configure Deploy Setup Configure
  • 77. App Server RDS Database Setup Configure Deploy Execute recipes Shutdown Attach recipes to events Setup Configure Deploy Setup Configure Configure
  • 78. App Server RDS Database Setup Configure Deploy Execute recipes Shutdown App Server Attach recipes to events Setup Configure Deploy Setup Configure Configure
  • 79. App Server RDS Database Setup Configure Deploy Execute recipes Shutdown App Server Attach recipes to events Setup Configure Deploy Change permissions Setup Configure Configure
  • 80. • OpsWorks items as CloudFormation resources • Automate deployment with CloudFormation • Automate "Day 2" management tasks with OpsWorks Combining OpsWorks and CloudFormation "Resources" : { "WordPressStack" : { "Type" : "AWS::OpsWorks::Stack", "Properties" : { "Name" : "MyWordPressStack", "ServiceRoleArn" : "arn:aws:iam::0123456789:role/service-role", "DefaultSshKeyName" : {"Ref":"KeyName"} } }, "myLayer": { "Type": "AWS::OpsWorks::Layer", "Properties": { "StackId": {"Ref": "WordPressStack"}, "Name": "PHP App Server", "Type": "php-app" } }
  • 81. The love story so far...
  • 82. The love story so far... • Repeatable deployments • Versioned Infrastructure as code • Use-case specific deployments • Management at scale • Application automation
  • 83. Next steps • Get the templates used in this session: http://s3.buzzy.geek.nz/summit2015 • Experiment!