SlideShare a Scribd company logo
CloudFormation 101
Dave Pigliavento
https://github.com/dpigliavento/cloudformation
What is CloudFormation?
CloudFormation is a zero cost AWS service for provisioning resources in
a predictable, repeatable and automated way.
** While CloudFormation does not cost anything the resources CloudFormation provisions do
https://github.com/dpigliavento/cloudformation
Why Use CloudFormation?
• No more clicking
• How do you know what changed and when?
• Infrastructure as code
• version controlled, know exactly what changed and when
• Easy to integrate in deployment pipeline
• Easy to replication infrastructure
• Build a common set of templates used across your organization
Rules of the Road:
• Do not start with CloudFormation!
• Learn first in the console
• Understand available options for a given service before jumping into
CloudFormation
• Don’t reinvent the wheel
• Find a template online to start with
• CloudFormation designer is a GUI tool for authoring templates
• Do not manually change resources CloudFormation deployed
• Future updates could potentially fail as a result
CloudFormation Concepts
• Template
• AWS infrastructure blueprint
• JSON or YAML formatted document
• Stack
• A collection of resources that are managed as a single unit
• Group resources that live the same lifecycle in a single stack
• Change Set
• dry-run for updating an existing stack
• provides the list of actions that will be taken
• Update behavior of stack resources
• Updates with no Interruption
• Updates with Some Interruption
• Replacement
• Unintended Resource Deletion
• Be careful with certain resources, if a change is not allowed
for a given parameter CloudFormation will destroy the
existing and create a new resource
(.i.e DynamoDB local index)
CloudFormation Template Anatomy (YAML)
CloudFormation Template Anatomy
Required: No
2010-09-09 is currently the only available options. This
setting identifies the capabilities of the template.
Play it safe and include this in all your templates. When
AWS does decide to add a new version you don’t need to
update existing templates.
CloudFormation Template Anatomy
Required: Yes
• The meat of a CloudFormation template
• All the AWS resources and their respective properties
CloudFormation Template Anatomy
Required: No
• Description of the template and the created stack
CloudFormation Template Anatomy
Required: No
• Input parameters for customizing deployed resources
• Allows you to generalize CloudFormation templates for
reuse
CloudFormation Template Anatomy
Required: No
• Provides a hash map of values that can be referenced
within your template
• Common use case is regional or environment specific
values
CloudFormation Template Anatomy
Required: No
• Allows you to define conditionals controlling when a
resource is created or a property is defined
CloudFormation Template Anatomy
Required: No
• Values you stack can output for information purposes or
to provide cross stack references
S3 Example Template
S3 Example Template
S3 Example - Template
S3 Example - Template
Intrinsic Functions
Use intrinsic functions in your templates to assign values to properties that are
not available until runtime
• Fn::Base64
• Condition Functions
• Fn::And
• Fn::Equals
• Fn::If
• Fn::Not
• Fn::Or
• Fn::FindInMap
• Fn::GetAtt
• Fn::GetAZs
• Fn::ImportValue
• Fn::Join
• Fn::Select
• Fn::Split
• Fn::Sub
• Ref
YAML Syntactic Sugar
!ImportValue
!Sub
!Ref
Pseudo Parameters
Predefined parameters available in your CloudFormation templates
• AWS::AccountId
• AWS::NotificationARNs
• AWS::NoValue
• AWS::Region
• AWS::StackId
• AWS::StackName
S3 Example - Template
S3 Example - Template
Resource Logical Id should not be
changed once created.
S3 Example – Changed Existing Logical ID
• Do not change logical id once created.
• Logical Ids are relevant only to the stack they are
deployed. You can reference within a single stack but
not outside from other stacks.
• Logical Ids must be unique within a given stack.
Extend S3 Template
Cross-Region Replication
S3 Example - Template
Input validation
• AllowedValues
• AllowdPatterns via regex
• MinValue/MaxValue for Integer
• MinLength/MaxLength for strings
S3 Example - Template
ReplicateBucket is True if
RemoteRegion parameter is NOT
equal to Disabled
S3 Example - Template
CreateRole is True if ReplicationRole
parameter is and empty string and
the condition ReplicateBucket is
True
S3 Example - Template
S3 cross-region replication requires
that versioning be enabled on the
bucket
S3 Example - Template
Conditional parameter block, AWS::NoValue
will remove the parameter when set.
S3 Example - Template
Dependencies
Cloudformation resources have implicit dependences based on the Ref
and GetAtt functions but you can explicitly define them as well.
Deploying Stacks Using AWSCLI
Deploying Stack (awscli) - Success
$
$ aws cloudformation deploy --stack-name test-stack --template-file stack.yaml –region us-west-2
Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - test-stack
Deploying Stack (awscli) - Failure
$
$ aws cloudformation deploy --stack-name test-stack --template-file stack.yaml
Waiting for changeset to be created..
Waiting for stack create/update to complete
Failed to create/update the stack. Run the following command
to fetch the list of events leading up to the failure
aws cloudformation describe-stack-events --stack-name test-stack
Debug Stack (awscli)
$
$ aws cloudformation describe-stack-events --stack-name test-stack
{
"StackEvents": [
{
"StackId": "arn:aws:cloudformation:us-east-1:740427342325:stack/test-stack/50d535e0-23c1-11e7-9f58-50faeaee44fd",
"EventId": "6a0ad860-23c3-11e7-8311-500c286e44d1",
"ResourceStatus": "UPDATE_ROLLBACK_COMPLETE",
"ResourceType": "AWS::CloudFormation::Stack",
"Timestamp": "2017-04-17T23:13:06.110Z",
"StackName": "test-stack",
"PhysicalResourceId": "arn:aws:cloudformation:us-east-1:740427342325:stack/test-stack/50d535e0-23c1-11e7-9f58-50faeaee44fd",
"LogicalResourceId": "test-stack"
},
...
Debug Stack (awscli)
$
$ aws cloudformation describe-stack-events --stack-name test-stack | jq ‘.StackEvents[] |
{Timestamp,ResourceStatus,ResourceType,ResourceStatusReason}’
"Timestamp": "2017-04-17T23:12:51.059Z",
"ResourceStatus": "CREATE_FAILED",
"ResourceType": "AWS::S3::Bucket",
"ResourceStatusReason": "capital-saratoga-region-aws-user-group already exists in stack
arn:aws:cloudformation:us-east-1:740427342325:stack/test-stack/50d535e0-23c1-11e7-9f58-
50faeaee44fd"
Debug Stack (Console)
EC2
+
CloudFormation
EC2 Example Template
EC2 Example Template
EC2 Example Template
EC2 Example Template
EC2 Example Template
Export Example Template
Exports
EC2 Example Template – Userdata Script
How does CloudFormation know
when my EC2 instance is ready?
CloudFormation Signaling
• Allows for external validation to occur before CloudFormation
considers a resource complete
• Ensures that your EC2 configuration is complete before
CloudFormation continues
• Can be a Create and/or Update policy for EC2 and ASG
EC2 Example Template – CreatePolicy
EC2 Example Template – cfn-signal
Cloudformation Helper Scripts
• A set of tools to assist with the configuration of EC2 that are
preinstalled on Amazon provided images
• cfn-signal: Notifies CloudFormation of a state change
• cfn-init: Uses resource metadata for instance bootstrap
• cfn-get-metadata: Get resource metadata
• cfn-hub: A daemon to check for updates to metadata and execute custom
hooks when changes are detected
cfn-init Helper Script
• Tool that completes initial bootstrap based on metadata provided in CloudFormation
template
• Commands
• Files
• Users
• Groups
• Packages
• Services
• Sources
• Preinstalled on Amazon provided images
• State based approach to instance configuration
• Can be executed multiple times to bring instance to desired state
EC2 Example Template – cfn-init
cfn-init vs userdata
• userdata is procedural and will only run once
• cfn-init is state based
• Can be run multiple times to bring instance to desired state
• Validation and logging built in
CloudFormation 101
Dave Pigliavento
https://github.com/dpigliavento/cloudformation

More Related Content

What's hot

Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
Lee Trout
 
Masterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormationMasterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormation
Amazon Web Services
 
K8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKSK8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKS
Amazon Web Services
 
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
Amazon Web Services
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
Amazon Web Services Korea
 
AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020
AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020 AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020
AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020
AWSKRUG - AWS한국사용자모임
 
AWS CloudFormation Best Practices
AWS CloudFormation Best PracticesAWS CloudFormation Best Practices
AWS CloudFormation Best Practices
Amazon Web Services
 
AWS Elastic Load Balancing for AWS Architect & SysOps Certification
AWS Elastic Load Balancing for AWS Architect & SysOps CertificationAWS Elastic Load Balancing for AWS Architect & SysOps Certification
AWS Elastic Load Balancing for AWS Architect & SysOps Certification
Sanjay Sharma
 
Become an AWS IAM Policy Ninja
Become an AWS IAM Policy NinjaBecome an AWS IAM Policy Ninja
Become an AWS IAM Policy Ninja
Amazon Web Services
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
Amazon Web Services
 
Intro to Amazon ECS
Intro to Amazon ECSIntro to Amazon ECS
Intro to Amazon ECS
Amazon Web Services
 
How to use IAM roles grant access to AWS
How to use IAM roles grant access to AWSHow to use IAM roles grant access to AWS
How to use IAM roles grant access to AWS
Amazon Web Services
 
Kubernetes on AWS with Amazon EKS
Kubernetes on AWS with Amazon EKSKubernetes on AWS with Amazon EKS
Kubernetes on AWS with Amazon EKS
Amazon Web Services
 
Deep Dive on Amazon S3 - AWS Online Tech Talks
Deep Dive on Amazon S3 - AWS Online Tech TalksDeep Dive on Amazon S3 - AWS Online Tech Talks
Deep Dive on Amazon S3 - AWS Online Tech Talks
Amazon Web Services
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
Ami Mahloof
 
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Amazon Web Services
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
Amazon Web Services
 
Introduction to AWS IAM
Introduction to AWS IAMIntroduction to AWS IAM
Introduction to AWS IAM
Knoldus Inc.
 
Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018
 Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018 Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018
Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018
Amazon Web Services Korea
 
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
Amazon Web Services Korea
 

What's hot (20)

Terraform: An Overview & Introduction
Terraform: An Overview & IntroductionTerraform: An Overview & Introduction
Terraform: An Overview & Introduction
 
Masterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormationMasterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormation
 
K8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKSK8s on AWS: Introducing Amazon EKS
K8s on AWS: Introducing Amazon EKS
 
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
 
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵 [AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
[AWS Dev Day] 실습워크샵 | Amazon EKS 핸즈온 워크샵
 
AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020
AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020 AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020
AWS SAM으로 서버리스 아키텍쳐 운영하기 - 이재면(마이뮤직테이스트) :: AWS Community Day 2020
 
AWS CloudFormation Best Practices
AWS CloudFormation Best PracticesAWS CloudFormation Best Practices
AWS CloudFormation Best Practices
 
AWS Elastic Load Balancing for AWS Architect & SysOps Certification
AWS Elastic Load Balancing for AWS Architect & SysOps CertificationAWS Elastic Load Balancing for AWS Architect & SysOps Certification
AWS Elastic Load Balancing for AWS Architect & SysOps Certification
 
Become an AWS IAM Policy Ninja
Become an AWS IAM Policy NinjaBecome an AWS IAM Policy Ninja
Become an AWS IAM Policy Ninja
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Intro to Amazon ECS
Intro to Amazon ECSIntro to Amazon ECS
Intro to Amazon ECS
 
How to use IAM roles grant access to AWS
How to use IAM roles grant access to AWSHow to use IAM roles grant access to AWS
How to use IAM roles grant access to AWS
 
Kubernetes on AWS with Amazon EKS
Kubernetes on AWS with Amazon EKSKubernetes on AWS with Amazon EKS
Kubernetes on AWS with Amazon EKS
 
Deep Dive on Amazon S3 - AWS Online Tech Talks
Deep Dive on Amazon S3 - AWS Online Tech TalksDeep Dive on Amazon S3 - AWS Online Tech Talks
Deep Dive on Amazon S3 - AWS Online Tech Talks
 
Terraform modules restructured
Terraform modules restructuredTerraform modules restructured
Terraform modules restructured
 
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
Best Practices to Secure Data Lake on AWS (ANT327) - AWS re:Invent 2018
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
 
Introduction to AWS IAM
Introduction to AWS IAMIntroduction to AWS IAM
Introduction to AWS IAM
 
Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018
 Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018 Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018
Terraform을 이용한 Infrastructure as Code 실전 구성하기 :: 변정훈::AWS Summit Seoul 2018
 
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
데브옵스 엔지니어를 위한 신규 운영 서비스 - 김필중, AWS 개발 전문 솔루션즈 아키텍트 / 김현민, 메가존클라우드 솔루션즈 아키텍트 :...
 

Similar to Cloudformation101

CloudFormation Best Practices
CloudFormation Best PracticesCloudFormation Best Practices
CloudFormation Best Practices
Amazon Web Services
 
Cnam azure ze cloud resource manager
Cnam azure ze cloud  resource managerCnam azure ze cloud  resource manager
Cnam azure ze cloud resource manager
Aymeric Weinbach
 
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Amazon Web Services
 
AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013
AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013
AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013
Amazon Web Services
 
AWS Cloud Formation
AWS Cloud Formation AWS Cloud Formation
AWS Cloud Formation
Adam Book
 
Azure from scratch part 3 By Girish Kalamati
Azure from scratch part 3 By Girish KalamatiAzure from scratch part 3 By Girish Kalamati
Azure from scratch part 3 By Girish Kalamati
Girish Kalamati
 
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
Amazon Web Services Korea
 
AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18
Neal Davis
 
MLflow Model Serving
MLflow Model ServingMLflow Model Serving
MLflow Model Serving
Databricks
 
Dev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew WebinarDev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew Webinar
Boaz Ziniman
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Bob German
 
AWS glue technical enablement training
AWS glue technical enablement trainingAWS glue technical enablement training
AWS glue technical enablement training
Info Alchemy Corporation
 
Infrastructure as code deployed using Stacker
Infrastructure as code deployed using StackerInfrastructure as code deployed using Stacker
Infrastructure as code deployed using Stacker
MessageMedia
 
Stacktician - CloudStack Collab Conference 2014
Stacktician - CloudStack Collab Conference 2014Stacktician - CloudStack Collab Conference 2014
Stacktician - CloudStack Collab Conference 2014
amoghvk
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
Chiradeep Vittal
 
MLflow Model Serving - DAIS 2021
MLflow Model Serving - DAIS 2021MLflow Model Serving - DAIS 2021
MLflow Model Serving - DAIS 2021
amesar0
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
Udaiappa Ramachandran
 
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
Rustem Feyzkhanov
 
Azure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu Ganta
Azure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu GantaAzure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu Ganta
Azure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu Ganta
Databricks
 
Infrastructure Continuous Delivery Using AWS CloudFormation
Infrastructure Continuous Delivery Using AWS CloudFormationInfrastructure Continuous Delivery Using AWS CloudFormation
Infrastructure Continuous Delivery Using AWS CloudFormation
Amazon Web Services
 

Similar to Cloudformation101 (20)

CloudFormation Best Practices
CloudFormation Best PracticesCloudFormation Best Practices
CloudFormation Best Practices
 
Cnam azure ze cloud resource manager
Cnam azure ze cloud  resource managerCnam azure ze cloud  resource manager
Cnam azure ze cloud resource manager
 
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
Assembling an AWS CloudFormation Authoring Tool Chain (DEV368-R2) - AWS re:In...
 
AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013
AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013
AWS Elastic Beanstalk under the Hood (DMG301) | AWS re:Invent 2013
 
AWS Cloud Formation
AWS Cloud Formation AWS Cloud Formation
AWS Cloud Formation
 
Azure from scratch part 3 By Girish Kalamati
Azure from scratch part 3 By Girish KalamatiAzure from scratch part 3 By Girish Kalamati
Azure from scratch part 3 By Girish Kalamati
 
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
오토스케일링 제대로 활용하기 (김일호) - AWS 웨비나 시리즈 2015
 
AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18AWS Certified Solutions Architect Professional Course S15-S18
AWS Certified Solutions Architect Professional Course S15-S18
 
MLflow Model Serving
MLflow Model ServingMLflow Model Serving
MLflow Model Serving
 
Dev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew WebinarDev & Test on AWS - Hebrew Webinar
Dev & Test on AWS - Hebrew Webinar
 
Azure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web ServicesAzure for SharePoint Developers - Workshop - Part 3: Web Services
Azure for SharePoint Developers - Workshop - Part 3: Web Services
 
AWS glue technical enablement training
AWS glue technical enablement trainingAWS glue technical enablement training
AWS glue technical enablement training
 
Infrastructure as code deployed using Stacker
Infrastructure as code deployed using StackerInfrastructure as code deployed using Stacker
Infrastructure as code deployed using Stacker
 
Stacktician - CloudStack Collab Conference 2014
Stacktician - CloudStack Collab Conference 2014Stacktician - CloudStack Collab Conference 2014
Stacktician - CloudStack Collab Conference 2014
 
StackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStackStackMate - CloudFormation for CloudStack
StackMate - CloudFormation for CloudStack
 
MLflow Model Serving - DAIS 2021
MLflow Model Serving - DAIS 2021MLflow Model Serving - DAIS 2021
MLflow Model Serving - DAIS 2021
 
Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
 
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
DataTalks.Club - Building Scalable End-to-End Deep Learning Pipelines in the ...
 
Azure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu Ganta
Azure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu GantaAzure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu Ganta
Azure Databricks – Customer Experiences and Lessons Denzil Ribeiro Madhu Ganta
 
Infrastructure Continuous Delivery Using AWS CloudFormation
Infrastructure Continuous Delivery Using AWS CloudFormationInfrastructure Continuous Delivery Using AWS CloudFormation
Infrastructure Continuous Delivery Using AWS CloudFormation
 

Recently uploaded

Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
alexjohnson7307
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
Shinana2
 

Recently uploaded (20)

Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
leewayhertz.com-AI in predictive maintenance Use cases technologies benefits ...
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
dbms calicut university B. sc Cs 4th sem.pdf
dbms  calicut university B. sc Cs 4th sem.pdfdbms  calicut university B. sc Cs 4th sem.pdf
dbms calicut university B. sc Cs 4th sem.pdf
 

Cloudformation101

  • 2. What is CloudFormation? CloudFormation is a zero cost AWS service for provisioning resources in a predictable, repeatable and automated way. ** While CloudFormation does not cost anything the resources CloudFormation provisions do https://github.com/dpigliavento/cloudformation
  • 3. Why Use CloudFormation? • No more clicking • How do you know what changed and when? • Infrastructure as code • version controlled, know exactly what changed and when • Easy to integrate in deployment pipeline • Easy to replication infrastructure • Build a common set of templates used across your organization
  • 4. Rules of the Road: • Do not start with CloudFormation! • Learn first in the console • Understand available options for a given service before jumping into CloudFormation • Don’t reinvent the wheel • Find a template online to start with • CloudFormation designer is a GUI tool for authoring templates • Do not manually change resources CloudFormation deployed • Future updates could potentially fail as a result
  • 5. CloudFormation Concepts • Template • AWS infrastructure blueprint • JSON or YAML formatted document • Stack • A collection of resources that are managed as a single unit • Group resources that live the same lifecycle in a single stack • Change Set • dry-run for updating an existing stack • provides the list of actions that will be taken
  • 6. • Update behavior of stack resources • Updates with no Interruption • Updates with Some Interruption • Replacement • Unintended Resource Deletion • Be careful with certain resources, if a change is not allowed for a given parameter CloudFormation will destroy the existing and create a new resource (.i.e DynamoDB local index)
  • 7.
  • 9. CloudFormation Template Anatomy Required: No 2010-09-09 is currently the only available options. This setting identifies the capabilities of the template. Play it safe and include this in all your templates. When AWS does decide to add a new version you don’t need to update existing templates.
  • 10. CloudFormation Template Anatomy Required: Yes • The meat of a CloudFormation template • All the AWS resources and their respective properties
  • 11. CloudFormation Template Anatomy Required: No • Description of the template and the created stack
  • 12. CloudFormation Template Anatomy Required: No • Input parameters for customizing deployed resources • Allows you to generalize CloudFormation templates for reuse
  • 13. CloudFormation Template Anatomy Required: No • Provides a hash map of values that can be referenced within your template • Common use case is regional or environment specific values
  • 14. CloudFormation Template Anatomy Required: No • Allows you to define conditionals controlling when a resource is created or a property is defined
  • 15. CloudFormation Template Anatomy Required: No • Values you stack can output for information purposes or to provide cross stack references
  • 18. S3 Example - Template
  • 19. S3 Example - Template
  • 20. Intrinsic Functions Use intrinsic functions in your templates to assign values to properties that are not available until runtime • Fn::Base64 • Condition Functions • Fn::And • Fn::Equals • Fn::If • Fn::Not • Fn::Or • Fn::FindInMap • Fn::GetAtt • Fn::GetAZs • Fn::ImportValue • Fn::Join • Fn::Select • Fn::Split • Fn::Sub • Ref YAML Syntactic Sugar !ImportValue !Sub !Ref
  • 21. Pseudo Parameters Predefined parameters available in your CloudFormation templates • AWS::AccountId • AWS::NotificationARNs • AWS::NoValue • AWS::Region • AWS::StackId • AWS::StackName
  • 22. S3 Example - Template
  • 23. S3 Example - Template Resource Logical Id should not be changed once created.
  • 24. S3 Example – Changed Existing Logical ID
  • 25. • Do not change logical id once created. • Logical Ids are relevant only to the stack they are deployed. You can reference within a single stack but not outside from other stacks. • Logical Ids must be unique within a given stack.
  • 27. S3 Example - Template Input validation • AllowedValues • AllowdPatterns via regex • MinValue/MaxValue for Integer • MinLength/MaxLength for strings
  • 28. S3 Example - Template ReplicateBucket is True if RemoteRegion parameter is NOT equal to Disabled
  • 29. S3 Example - Template CreateRole is True if ReplicationRole parameter is and empty string and the condition ReplicateBucket is True
  • 30. S3 Example - Template S3 cross-region replication requires that versioning be enabled on the bucket
  • 31. S3 Example - Template Conditional parameter block, AWS::NoValue will remove the parameter when set.
  • 32. S3 Example - Template
  • 33. Dependencies Cloudformation resources have implicit dependences based on the Ref and GetAtt functions but you can explicitly define them as well.
  • 35. Deploying Stack (awscli) - Success $ $ aws cloudformation deploy --stack-name test-stack --template-file stack.yaml –region us-west-2 Waiting for changeset to be created.. Waiting for stack create/update to complete Successfully created/updated stack - test-stack
  • 36. Deploying Stack (awscli) - Failure $ $ aws cloudformation deploy --stack-name test-stack --template-file stack.yaml Waiting for changeset to be created.. Waiting for stack create/update to complete Failed to create/update the stack. Run the following command to fetch the list of events leading up to the failure aws cloudformation describe-stack-events --stack-name test-stack
  • 37. Debug Stack (awscli) $ $ aws cloudformation describe-stack-events --stack-name test-stack { "StackEvents": [ { "StackId": "arn:aws:cloudformation:us-east-1:740427342325:stack/test-stack/50d535e0-23c1-11e7-9f58-50faeaee44fd", "EventId": "6a0ad860-23c3-11e7-8311-500c286e44d1", "ResourceStatus": "UPDATE_ROLLBACK_COMPLETE", "ResourceType": "AWS::CloudFormation::Stack", "Timestamp": "2017-04-17T23:13:06.110Z", "StackName": "test-stack", "PhysicalResourceId": "arn:aws:cloudformation:us-east-1:740427342325:stack/test-stack/50d535e0-23c1-11e7-9f58-50faeaee44fd", "LogicalResourceId": "test-stack" }, ...
  • 38. Debug Stack (awscli) $ $ aws cloudformation describe-stack-events --stack-name test-stack | jq ‘.StackEvents[] | {Timestamp,ResourceStatus,ResourceType,ResourceStatusReason}’ "Timestamp": "2017-04-17T23:12:51.059Z", "ResourceStatus": "CREATE_FAILED", "ResourceType": "AWS::S3::Bucket", "ResourceStatusReason": "capital-saratoga-region-aws-user-group already exists in stack arn:aws:cloudformation:us-east-1:740427342325:stack/test-stack/50d535e0-23c1-11e7-9f58- 50faeaee44fd"
  • 48. EC2 Example Template – Userdata Script
  • 49. How does CloudFormation know when my EC2 instance is ready?
  • 50. CloudFormation Signaling • Allows for external validation to occur before CloudFormation considers a resource complete • Ensures that your EC2 configuration is complete before CloudFormation continues • Can be a Create and/or Update policy for EC2 and ASG
  • 51. EC2 Example Template – CreatePolicy
  • 52. EC2 Example Template – cfn-signal
  • 53.
  • 54. Cloudformation Helper Scripts • A set of tools to assist with the configuration of EC2 that are preinstalled on Amazon provided images • cfn-signal: Notifies CloudFormation of a state change • cfn-init: Uses resource metadata for instance bootstrap • cfn-get-metadata: Get resource metadata • cfn-hub: A daemon to check for updates to metadata and execute custom hooks when changes are detected
  • 55. cfn-init Helper Script • Tool that completes initial bootstrap based on metadata provided in CloudFormation template • Commands • Files • Users • Groups • Packages • Services • Sources • Preinstalled on Amazon provided images • State based approach to instance configuration • Can be executed multiple times to bring instance to desired state
  • 56. EC2 Example Template – cfn-init
  • 57. cfn-init vs userdata • userdata is procedural and will only run once • cfn-init is state based • Can be run multiple times to bring instance to desired state • Validation and logging built in

Editor's Notes

  1. All examples will be shown in yaml
  2. Hash map that can provide appropriate AMI Id based on region
  3. Userdata script is execute the first time EC2 instances boots and never again