SlideShare a Scribd company logo
Mahesh TR
CloudFormation
Mahesh TR
AWS CloudFormation is a service that helps you model and set up your Amazon Web Services resources
so you can spend less time managing those resources, and more time focusing on your applications.
CloudFormation can:
✓ Simplify infrastructure management.
✓ Quickly replicate your infrastructure.
✓ Easily control and track changes to your infrastructure.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
CloudFormation
Mahesh TR
How it works ?
Mahesh TR
Organize by Layers and Environments
Frontend Services
Backend services
Common monitoring, Subnets and
SG
VPC, IGW, RT, NAT, VPN
IAM user, groups or roles
DEV Account QA Account Prod Account
Mahesh TR
CloudFormation
AWS CloudFormation gives developers and systems administrators an easy way to create and manage a
collection of related AWS resources, provision and update them in an orderly and predictable fashion
✓ Template
✓ is an architectural diagram
✓ a JSON or YAML-format, text-based file that describes all the AWS resources you need to deploy
to run your application
✓ Stack
✓ is the end result of that diagram, which is actually provisioned
✓ is the set of AWS resources that are created and managed as a single unit when CloudFormation
instantiates a template.
Mahesh TR
✓CloudFormation template can be used to set up the resources consistently and repeatedly over
and over across multiple regions
✓Resources can be updated, deleted and modified in a controlled and predictable way, in effect
applying version control to the infrastructure as done for software code
✓CloudFormation supports Chef & Puppet Integration, meaning that you can deploy and configure
right down the application layer
✓By default, automatic rollback on error feature is enabled, which will cause all the AWS resources
thatCloudFormation created successfully for a stack up to the point where an error occurred to be
deleted. However, charges would be applied for the resources the time they are up and running
Mahesh TR
Template Basics
✓ A CloudFormation template is a JSON-formatted (JavaScript Object Notation) text file that
describes your AWS infrastructure.
 Templates can include several major sections:
– AWSTemplateFormatVersion
– Description
– Parameters
– Mappings
– Conditions
– Resources
– Metadata and Userdata
– Outputs
✓ The Resources section is the only section that is actually required.
✓ The first character in the CloudFormation template must be an open brace ({), and the last character
must be a closed brace (}).
Mahesh TR
Template Basics
{
"AWSTempletFormatVersion" : "2010-09-09",
"Description" : “Test Demo Server"
"Parameters" : {......}
"Mappings" : {......}
"Resources" : {......}
"Outputs" : {......}
}
"Resources" : {
"Logical ID" : {
"Type" : "Resource type",
"Properties" : {
Set of properties
}
}
}
http://jsoneditoronline.org/
Mahesh TR
Resource Syntax
Resource type is defined as
AWS::AWS-PRODUCT-NAME::DATA-TYPE-NAME
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
Example
✓AWS::S3::Bucket
✓AWS::EC2::Instance
✓AWS::EC2::Route
✓AWS::EC2::Subnet
✓AWS::EC2::VPC
✓AWS::EMR::Cluster
✓AWS::Lambda::Function
✓AWS::RDS::DBInstance
✓AWS::SNS::Topic
"Resources" : {
"Logical ID" : {
"Type" : "Resource type",
"Properties" : {
Set of properties
}
}
}
"Resources" : {
" S3bucketNew" : {
"Type" : "AWS::S3::Bucket"
}
}
Mahesh TR
Resource Syntax
{
"Resources" : {
" S3bucketNew" : {
"Type" : "AWS::S3::Bucket“
"Properties" : {
"AccessControl" : "PublicRead"
}
}
}
}
{
"Resources" : {
" S3bucketNew" : {
"Type" : "resource type“
"Properties" : {
"AccessControl" : “String”
}
}
}
}
Mahesh TR{
"AWSTempletFormatVersion" : "2010-09-09",
"Description" : "Test Demo Server"
"Resources" : {
"HelloBucket" : { ... },
"EC2Instance" : { ... },
"ElasticIP" : { ... },
"InstanceSecurityGroup" : { ... }
}
}
{ …..
"Resources" : {
"HelloBucket" : {
"Type" : "AWS::S3::Bucket“
"Properties" : {
"AccessControl" : "PublicRead"
}
}
}
}
"Resources" : {
"MyEC2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : "ami-2f726546"
}
}
}
Bucket
Instance
Mahesh TR
Resource Syntax
Example
✓AWS::S3::Bucket
✓AWS::EC2::Instance
✓AWS::EC2::Route
✓AWS::EC2::Subnet
✓AWS::EC2::VPC
✓AWS::EMR::Cluster
✓AWS::Lambda::Function
✓AWS::RDS::DBInstance
✓AWS::SNS::Topic
"Resources" : {
"Logical ID" : {
"Type" : "Resource type",
"Properties" : {
Set of properties
}
}
}
"Resources" : {
"MyEC2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : "ami-2f726546"
}
}
}
Resource type is defined as
AWS::AWS-PRODUCT-NAME::DATA-TYPE-NAME
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
Mahesh TR
{
....
"Resources" : {
"EC2Instance" : {
"Type": "AWS::EC2::Instance",
"Properties" : { ... }
}
}
}
{ …….
“Resources”
"EC2Instance" : {
"Type": "AWS::EC2::Instance",
"Properties" : {
“ImageID”: “ami-bff43rcd”,
“InstanceType” : “t2.nano”,
"SecurityGroups": “sg-546hgul”
}
}
}
Mahesh TR
Mahesh TR
{ …….
“Resources”
"EC2Instance" : {
"Type": "AWS::EC2::Instance",
"Properties" : {
“ImageID”: “ami-bff43rcd”,
"SecurityGroup": “sg-546hgul”,
“InstanceType” : “t2.nano”
}
}
}
{
"Resources": {
"Ec2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
“ImageID”: “ami-bff43rcd”,
“SecurityGroups": [{"Ref": "InstanceSecurityGroup"}],
“InstanceType” : “t2.nano”
}
},
"InstanceSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "Enable SSH access via port 22",
"SecurityGroupIngress": [
{
"IpProtocol": "tcp",
"FromPort": "22",
"ToPort": "22",
"CidrIp": "0.0.0.0/0"
}
]
}
}
}
{
"AWSTempletFormatVersion" : "2010-09-09",
"Description" : "Test Demo Server"
"Resources" : {
"EC2Instance" : { ... },
“InstanceSecurityGroup" : { ... }
}
}
1
2
Mahesh TR"Resources" : {
"Logical ID" : {
"Type" : "Resource type",
"Properties" : {
Set of properties
}
}
}
✓ AWS::S3::Bucket
✓ AWS::EC2::Instance
✓ AWS::EC2::Route
✓ AWS::EC2::Subnet
✓ AWS::EC2::VPC
✓ AWS::EMR::Cluster
✓ AWS::Lambda::Function
✓ AWS::RDS::DBInstance
✓ AWS::SNS::Topic
{ …….
“Resources”
"EC2Instance" : {
"Type": "AWS::EC2::Instance",
"Properties" : {
“ImageID”: “ami-bff43rcd”,
"SecurityGroup": “sg-546hgul”,
“InstanceType” : “t2.nano”
}
}
}
Type
Property
"Resources": {
"Ec2Instance": {
"Type": "AWS::EC2::Instance",
"Properties": {
“SecurityGroups": [{"Ref": "InstanceSecurityGroup"}],
}
},
"InstanceSecurityGroup": {……..
}
}
Refer resource to resource
Mahesh TR
X AWSTemplateFormatVersion
X Description
– Parameters
– Mappings
X Resources --- Bucket and Instance creation
– Outputs
Mahesh TR
Mahesh TR
Parameter Syntax
"Parameters" : {
"ParameterLogicalID" : {
"Type" : "DataType",
"Parameter" : "value"
}
}
"Parameters" : {
"InstanceType" : {
"Type" : "String",
"Default" : "t2.micro",
"Description" : "Type of EC2 instance to launch"
}
}
Example
Mahesh TR
Parameter Syntax
"Parameters" : {
"InstanceType" : {
"Type" : "String",
"Default" : "t2.micro",
"Description" : "Type of EC2 instance to
launch"
}
}
"Parameters" : {
"InstanceType" : {
"Type" : "String",
"Default" : "t2.micro",
"AllowedValues" : ["t2.micro", "m1.small",
"m1.large"],
"Description" : "Type of EC2 instance to launch"
}
}
Mahesh TR
Parameter Syntax
"Parameters" : {
"InstanceType" : {
"Type" : "String",
"Default" : "t2.micro",
"AllowedValues" : ["t2.micro", "m1.small",
"m1.large"],
"Description" : "Type of EC2 instance to
launch"
}
}
"Parameters" : {
"KeyPairName": {
"Description" : "Name of an existing Amazon EC2 key pair",
"Type": "String",
},
"InstanceType": {
"Description" : "Amazon EC2 instance type",
"Type": "String",
}
}
Mahesh TR
Refer input parameter to Resources
"Parameters" : {
"KeyPairName": {
"Description" : "Name of an existing Amazon EC2 key pair",
"Type": "String",
},
"InstanceType": {
"Description" : "Amazon EC2 instance type",
"Type": "String",
}
}
"Resources" : {
"EC2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"InstanceType" : { "Ref" : "InstanceType" },
"ImageId" : { "Ref" : "AMIImageId" },
"KeyName" : { "Ref" : "KeyName" }
}
}
}
Mahesh TR
Mahesh TR
Mahesh TR
Mahesh TR
X AWSTemplateFormatVersion
X Description
X Parameters – keypair, instance type, etc ..
– Mappings
X Resources -- Bucket and Instance creation
– Outputs
Mahesh TR
Mahesh TR
Output Syntax
"Outputs" : {
"Logical ID" : {
"Description" : "Information about the value",
"Value" : "Value to return",
}
}
"Outputs" : {
"InstanceID" : {
"Description": "The Instance ID",
"Value" : { "Ref" : "EC2Instance" }
}
}
Example
Mahesh TR
Mahesh TR
X AWSTemplateFormatVersion
X Description
X Parameters-- keypair, instance type, etc ..
– Mappings
X Resources -- Bucket and Instance creation
X Outputs -- InstanceID, PublicDNS and Public IP etc…
Mahesh TR
Mahesh TR
Mapping Syntax
"Mappings" : {
"Mapping01" : {
"Key01" : { "Name" : "Value01"},
"Key02" : { "Name" : "Value02"},
"Key03" : { "Name" : "Value03"}
}
}
Example
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "32" : "ami-6411e20d"},
"us-west-1" : { "32" : "ami-c9c7978c"},
"eu-west-1" : { "32" : "ami-37c2f643"},
"ap-southeast-1" : { "32" : "ami-66f28c34"},
"ap-northeast-1" : { "32" : "ami-9c03a89d"}
}
}
Basic Mapping
Mahesh TR
Mapping Syntax
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "32" : "ami-6411e20d"},
"us-west-1" : { "32" : "ami-c9c7978c"},
"eu-west-1" : { "32" : "ami-37c2f643"},
"ap-southeast-1" : { "32" : "ami-66f28c34"},
"ap-northeast-1" : { "32" : "ami-9c03a89d"}
}
}
"RegionMap" : {
"us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-7a11e213" },
"us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" },
"eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" },
"ap-southeast-1" : { "32" : "ami-66f28c34", "64" : "ami-60f28c32" },
"ap-northeast-1" : { "32" : "ami-9c03a89d", "64" : "ami-a003a8a1" }
}
Mapping with Multiple Values
Basic Mapping
Mahesh TR{
"AWSTemplateFormatVersion" : "2010-09-09",
"Mappings" : {
"RegionMap" : {
"us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-7a11e213" },
"us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" },
"eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" }
}
},
"Resources" : {
"myEC2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "32"]},
"InstanceType" : "m1.small"
}
}
}
}
Return a Value from a Mapping
{ "Fn::FindInMap" : [ "MapName", "TopLevelKey", "SecondLevelKey"] }
Mahesh TR{
"Parameters" : {
"EnvironmentType": {
"Description": "The environment type",
"Type": "String",
"Default": "test",
"AllowedValues": ["prod", "test"],
"ConstraintDescription": "must be a prod or test"
}
},
"Mappings" : {
"RegionAndInstanceTypeToAMIID" : {
"us-east-1": {
"test": "ami-8ff710e2", "prod": "ami-f5f41398"},
"us-west-2" : {
"test" : "ami-eff1028f", "prod" : "ami-d0f506b0"},
...other regions and AMI IDs...
}
},
"Resources" : {
...other resources...
}
Mahesh TR
X AWSTemplateFormatVersion
X Description
X Parameters-- keypair, instance type, etc ..
X Mappings – selecting AMIs is multiple reagion
X Resources -- Bucket and Instance creation
Metadata and Userdata
X Outputs -- InstanceID, PublicDNS and Public IP etc…
Mahesh TR
UserData/Metadata
How to use Metadata ?
• https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide
/aws-resource-init.html#aws-resource-init-configsets
Example
• https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide
/deploying.applications.html
Mahesh TR
Public Subnet
192.168.1.20/32
SG NACL
webserversSG
webserver
Port Source
22 12.32.54.85/32
80 0.0.0.0/0
CIDR : 192.168.1.0/24
CIDR : 192.168.0.0/16 12.32.54.85/32
2280
Destination Target
192.168.0.0/16 Local
0.0.0.0/0 IGW
Private Subnet CIDR : 192.168.2.0/24
SGNACL
AppserversSG
Port Source
22 192.168.1.20/32
Destination Target
192.168.0.0/16 Local
0.0.0.0/0 NAT ID
Appservers
Route Table 1
Route Table 2
192.168.1.40/32
SG
NatSG
Natserver
Port Source
All Traffic 192.168.2.30/32
192.168.2.30/32
Mahesh TR
DEV Account QA Account
Mahesh TR

More Related Content

What's hot

NET304_Deep Dive into the New Network Load Balancer
NET304_Deep Dive into the New Network Load BalancerNET304_Deep Dive into the New Network Load Balancer
NET304_Deep Dive into the New Network Load Balancer
Amazon Web Services
 
Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...
Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...
Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...
Amazon Web Services
 
AWS Connectivity, VPC Design and Security Pro Tips
AWS Connectivity, VPC Design and Security Pro TipsAWS Connectivity, VPC Design and Security Pro Tips
AWS Connectivity, VPC Design and Security Pro Tips
Shiva Narayanaswamy
 
Deep Dive on Amazon EC2 Systems Manager
Deep Dive on Amazon EC2 Systems ManagerDeep Dive on Amazon EC2 Systems Manager
Deep Dive on Amazon EC2 Systems Manager
Amazon Web Services
 
AWS Security Best Practices
AWS Security Best PracticesAWS Security Best Practices
AWS Security Best Practices
Amazon Web Services
 
Amazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better TogetherAmazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better Together
Danilo Poccia
 
Getting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless ComputingGetting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless Computing
Amazon Web Services
 
AWSome Day Online 2020_Module 1: Introduction to the AWS Cloud
AWSome Day Online 2020_Module 1: Introduction to the AWS CloudAWSome Day Online 2020_Module 1: Introduction to the AWS Cloud
AWSome Day Online 2020_Module 1: Introduction to the AWS Cloud
Amazon Web Services
 
Deploy and Govern at Scale with AWS Control Tower
Deploy and Govern at Scale with AWS Control TowerDeploy and Govern at Scale with AWS Control Tower
Deploy and Govern at Scale with AWS Control Tower
Amazon Web Services
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best Practices
Amazon Web Services
 
AWS 101
AWS 101AWS 101
BDA311 Introduction to AWS Glue
BDA311 Introduction to AWS GlueBDA311 Introduction to AWS Glue
BDA311 Introduction to AWS Glue
Amazon Web Services
 
AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018
AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018
AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018
Amazon Web Services
 
Deep Dive: AWS CloudFormation
Deep Dive: AWS CloudFormationDeep Dive: AWS CloudFormation
Deep Dive: AWS CloudFormation
Amazon Web Services
 
Security Architectures on AWS
Security Architectures on AWSSecurity Architectures on AWS
Security Architectures on AWS
Amazon Web Services
 
AWS Monitoring & Logging
AWS Monitoring & LoggingAWS Monitoring & Logging
AWS Monitoring & Logging
Jason Poley
 
Technical Essentials Training: AWS Innovate Ottawa
Technical Essentials Training: AWS Innovate OttawaTechnical Essentials Training: AWS Innovate Ottawa
Technical Essentials Training: AWS Innovate Ottawa
Amazon Web Services
 
AWS EC2
AWS EC2AWS EC2
AWS EC2
Mahesh Raj
 
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Amazon Web Services
 
AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...
AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...
AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...
Edureka!
 

What's hot (20)

NET304_Deep Dive into the New Network Load Balancer
NET304_Deep Dive into the New Network Load BalancerNET304_Deep Dive into the New Network Load Balancer
NET304_Deep Dive into the New Network Load Balancer
 
Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...
Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...
Migrating Databases to the Cloud: Introduction to AWS DMS - SRV215 - Chicago ...
 
AWS Connectivity, VPC Design and Security Pro Tips
AWS Connectivity, VPC Design and Security Pro TipsAWS Connectivity, VPC Design and Security Pro Tips
AWS Connectivity, VPC Design and Security Pro Tips
 
Deep Dive on Amazon EC2 Systems Manager
Deep Dive on Amazon EC2 Systems ManagerDeep Dive on Amazon EC2 Systems Manager
Deep Dive on Amazon EC2 Systems Manager
 
AWS Security Best Practices
AWS Security Best PracticesAWS Security Best Practices
AWS Security Best Practices
 
Amazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better TogetherAmazon API Gateway and AWS Lambda: Better Together
Amazon API Gateway and AWS Lambda: Better Together
 
Getting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless ComputingGetting Started with AWS Lambda Serverless Computing
Getting Started with AWS Lambda Serverless Computing
 
AWSome Day Online 2020_Module 1: Introduction to the AWS Cloud
AWSome Day Online 2020_Module 1: Introduction to the AWS CloudAWSome Day Online 2020_Module 1: Introduction to the AWS Cloud
AWSome Day Online 2020_Module 1: Introduction to the AWS Cloud
 
Deploy and Govern at Scale with AWS Control Tower
Deploy and Govern at Scale with AWS Control TowerDeploy and Govern at Scale with AWS Control Tower
Deploy and Govern at Scale with AWS Control Tower
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best Practices
 
AWS 101
AWS 101AWS 101
AWS 101
 
BDA311 Introduction to AWS Glue
BDA311 Introduction to AWS GlueBDA311 Introduction to AWS Glue
BDA311 Introduction to AWS Glue
 
AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018
AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018
AWS Landing Zone Deep Dive (ENT350-R2) - AWS re:Invent 2018
 
Deep Dive: AWS CloudFormation
Deep Dive: AWS CloudFormationDeep Dive: AWS CloudFormation
Deep Dive: AWS CloudFormation
 
Security Architectures on AWS
Security Architectures on AWSSecurity Architectures on AWS
Security Architectures on AWS
 
AWS Monitoring & Logging
AWS Monitoring & LoggingAWS Monitoring & Logging
AWS Monitoring & Logging
 
Technical Essentials Training: AWS Innovate Ottawa
Technical Essentials Training: AWS Innovate OttawaTechnical Essentials Training: AWS Innovate Ottawa
Technical Essentials Training: AWS Innovate Ottawa
 
AWS EC2
AWS EC2AWS EC2
AWS EC2
 
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
Threat detection on AWS: An introduction to Amazon GuardDuty - FND216 - AWS r...
 
AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...
AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...
AWS IAM Tutorial | Identity And Access Management (IAM) | AWS Training Videos...
 

Similar to AWS Cloud Formation

Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as Code
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
 
Infrastructure as Code
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
Amazon Web Services
 
Masterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormationMasterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormation
Amazon Web Services
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
Amazon Web Services
 
Programando sua infraestrutura com o AWS CloudFormation
Programando sua infraestrutura com o AWS CloudFormationProgramando sua infraestrutura com o AWS CloudFormation
Programando sua infraestrutura com o AWS CloudFormation
Amazon Web Services LATAM
 
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
Amazon Web Services
 
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
Amazon Web Services
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
Amazon Web Services
 
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as CodeAWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
Amazon Web Services
 
AWS CloudFormation Masterclass
AWS CloudFormation Masterclass AWS CloudFormation Masterclass
AWS CloudFormation Masterclass
Ian Massingham
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
Amazon Web Services
 
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,...
Amazon Web Services
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
Amazon Web Services
 
DevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
DevOps on AWS: Deep Dive on Infrastructure as Code - TorontoDevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
DevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
Amazon Web Services
 
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and ToolsDeployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Danilo Poccia
 
Managing Your Infrastructure as Code
Managing Your Infrastructure as CodeManaging Your Infrastructure as Code
Managing Your Infrastructure as Code
Amazon Web Services
 
CloudFormation Best Practices
CloudFormation Best PracticesCloudFormation Best Practices
CloudFormation Best Practices
Amazon Web Services
 
AWS CloudFormation Session
AWS CloudFormation SessionAWS CloudFormation Session
AWS CloudFormation Session
Kamal Maiti
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
Amazon Web Services
 

Similar to AWS Cloud Formation (20)

Deep Dive - Infrastructure as Code
Deep Dive - Infrastructure as CodeDeep Dive - Infrastructure as Code
Deep Dive - Infrastructure as Code
 
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
Infrastructure as CodeInfrastructure as Code
Infrastructure as Code
 
Masterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormationMasterclass Webinar - AWS CloudFormation
Masterclass Webinar - AWS CloudFormation
 
infrastructure as code
infrastructure as codeinfrastructure as code
infrastructure as code
 
Programando sua infraestrutura com o AWS CloudFormation
Programando sua infraestrutura com o AWS CloudFormationProgramando sua infraestrutura com o AWS CloudFormation
Programando sua infraestrutura com o AWS CloudFormation
 
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
 
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
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as CodeAWS January 2016 Webinar Series - Managing your Infrastructure as Code
AWS January 2016 Webinar Series - Managing your Infrastructure as Code
 
AWS CloudFormation Masterclass
AWS CloudFormation Masterclass AWS CloudFormation Masterclass
AWS CloudFormation Masterclass
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
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,...
 
Deep Dive: Infrastructure as Code
Deep Dive: Infrastructure as CodeDeep Dive: Infrastructure as Code
Deep Dive: Infrastructure as Code
 
DevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
DevOps on AWS: Deep Dive on Infrastructure as Code - TorontoDevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
DevOps on AWS: Deep Dive on Infrastructure as Code - Toronto
 
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and ToolsDeployment and Management on AWS:
 A Deep Dive on Options and Tools
Deployment and Management on AWS:
 A Deep Dive on Options and Tools
 
Managing Your Infrastructure as Code
Managing Your Infrastructure as CodeManaging Your Infrastructure as Code
Managing Your Infrastructure as Code
 
CloudFormation Best Practices
CloudFormation Best PracticesCloudFormation Best Practices
CloudFormation Best Practices
 
AWS CloudFormation Session
AWS CloudFormation SessionAWS CloudFormation Session
AWS CloudFormation Session
 
Deep Dive into AWS SAM
Deep Dive into AWS SAMDeep Dive into AWS SAM
Deep Dive into AWS SAM
 

More from Mahesh Raj

AWS AutoScaling
AWS AutoScalingAWS AutoScaling
AWS AutoScaling
Mahesh Raj
 
AWS ELB
AWS ELBAWS ELB
AWS ELB
Mahesh Raj
 
AWS EBS
AWS EBSAWS EBS
AWS EBS
Mahesh Raj
 
Aws cloud watch
Aws cloud watchAws cloud watch
Aws cloud watch
Mahesh Raj
 
AWS RDS
AWS RDSAWS RDS
AWS RDS
Mahesh Raj
 
SNS SQS SWF and Kinesis
SNS SQS SWF and KinesisSNS SQS SWF and Kinesis
SNS SQS SWF and Kinesis
Mahesh Raj
 
AWS Cloud Front and Cloud Formation
AWS Cloud Front and Cloud FormationAWS Cloud Front and Cloud Formation
AWS Cloud Front and Cloud Formation
Mahesh Raj
 
AWS S3 and GLACIER
AWS S3 and GLACIERAWS S3 and GLACIER
AWS S3 and GLACIER
Mahesh Raj
 
AWS Virtual Private Cloud
AWS Virtual Private CloudAWS Virtual Private Cloud
AWS Virtual Private Cloud
Mahesh Raj
 
AWS Identity and access Managment
AWS Identity and access ManagmentAWS Identity and access Managment
AWS Identity and access Managment
Mahesh Raj
 

More from Mahesh Raj (10)

AWS AutoScaling
AWS AutoScalingAWS AutoScaling
AWS AutoScaling
 
AWS ELB
AWS ELBAWS ELB
AWS ELB
 
AWS EBS
AWS EBSAWS EBS
AWS EBS
 
Aws cloud watch
Aws cloud watchAws cloud watch
Aws cloud watch
 
AWS RDS
AWS RDSAWS RDS
AWS RDS
 
SNS SQS SWF and Kinesis
SNS SQS SWF and KinesisSNS SQS SWF and Kinesis
SNS SQS SWF and Kinesis
 
AWS Cloud Front and Cloud Formation
AWS Cloud Front and Cloud FormationAWS Cloud Front and Cloud Formation
AWS Cloud Front and Cloud Formation
 
AWS S3 and GLACIER
AWS S3 and GLACIERAWS S3 and GLACIER
AWS S3 and GLACIER
 
AWS Virtual Private Cloud
AWS Virtual Private CloudAWS Virtual Private Cloud
AWS Virtual Private Cloud
 
AWS Identity and access Managment
AWS Identity and access ManagmentAWS Identity and access Managment
AWS Identity and access Managment
 

Recently uploaded

Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

AWS Cloud Formation

  • 2. Mahesh TR AWS CloudFormation is a service that helps you model and set up your Amazon Web Services resources so you can spend less time managing those resources, and more time focusing on your applications. CloudFormation can: ✓ Simplify infrastructure management. ✓ Quickly replicate your infrastructure. ✓ Easily control and track changes to your infrastructure. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html CloudFormation
  • 4. Mahesh TR Organize by Layers and Environments Frontend Services Backend services Common monitoring, Subnets and SG VPC, IGW, RT, NAT, VPN IAM user, groups or roles DEV Account QA Account Prod Account
  • 5. Mahesh TR CloudFormation AWS CloudFormation gives developers and systems administrators an easy way to create and manage a collection of related AWS resources, provision and update them in an orderly and predictable fashion ✓ Template ✓ is an architectural diagram ✓ a JSON or YAML-format, text-based file that describes all the AWS resources you need to deploy to run your application ✓ Stack ✓ is the end result of that diagram, which is actually provisioned ✓ is the set of AWS resources that are created and managed as a single unit when CloudFormation instantiates a template.
  • 6. Mahesh TR ✓CloudFormation template can be used to set up the resources consistently and repeatedly over and over across multiple regions ✓Resources can be updated, deleted and modified in a controlled and predictable way, in effect applying version control to the infrastructure as done for software code ✓CloudFormation supports Chef & Puppet Integration, meaning that you can deploy and configure right down the application layer ✓By default, automatic rollback on error feature is enabled, which will cause all the AWS resources thatCloudFormation created successfully for a stack up to the point where an error occurred to be deleted. However, charges would be applied for the resources the time they are up and running
  • 7. Mahesh TR Template Basics ✓ A CloudFormation template is a JSON-formatted (JavaScript Object Notation) text file that describes your AWS infrastructure.  Templates can include several major sections: – AWSTemplateFormatVersion – Description – Parameters – Mappings – Conditions – Resources – Metadata and Userdata – Outputs ✓ The Resources section is the only section that is actually required. ✓ The first character in the CloudFormation template must be an open brace ({), and the last character must be a closed brace (}).
  • 8. Mahesh TR Template Basics { "AWSTempletFormatVersion" : "2010-09-09", "Description" : “Test Demo Server" "Parameters" : {......} "Mappings" : {......} "Resources" : {......} "Outputs" : {......} } "Resources" : { "Logical ID" : { "Type" : "Resource type", "Properties" : { Set of properties } } } http://jsoneditoronline.org/
  • 9. Mahesh TR Resource Syntax Resource type is defined as AWS::AWS-PRODUCT-NAME::DATA-TYPE-NAME https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Example ✓AWS::S3::Bucket ✓AWS::EC2::Instance ✓AWS::EC2::Route ✓AWS::EC2::Subnet ✓AWS::EC2::VPC ✓AWS::EMR::Cluster ✓AWS::Lambda::Function ✓AWS::RDS::DBInstance ✓AWS::SNS::Topic "Resources" : { "Logical ID" : { "Type" : "Resource type", "Properties" : { Set of properties } } } "Resources" : { " S3bucketNew" : { "Type" : "AWS::S3::Bucket" } }
  • 10. Mahesh TR Resource Syntax { "Resources" : { " S3bucketNew" : { "Type" : "AWS::S3::Bucket“ "Properties" : { "AccessControl" : "PublicRead" } } } } { "Resources" : { " S3bucketNew" : { "Type" : "resource type“ "Properties" : { "AccessControl" : “String” } } } }
  • 11. Mahesh TR{ "AWSTempletFormatVersion" : "2010-09-09", "Description" : "Test Demo Server" "Resources" : { "HelloBucket" : { ... }, "EC2Instance" : { ... }, "ElasticIP" : { ... }, "InstanceSecurityGroup" : { ... } } } { ….. "Resources" : { "HelloBucket" : { "Type" : "AWS::S3::Bucket“ "Properties" : { "AccessControl" : "PublicRead" } } } } "Resources" : { "MyEC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "ImageId" : "ami-2f726546" } } } Bucket Instance
  • 12. Mahesh TR Resource Syntax Example ✓AWS::S3::Bucket ✓AWS::EC2::Instance ✓AWS::EC2::Route ✓AWS::EC2::Subnet ✓AWS::EC2::VPC ✓AWS::EMR::Cluster ✓AWS::Lambda::Function ✓AWS::RDS::DBInstance ✓AWS::SNS::Topic "Resources" : { "Logical ID" : { "Type" : "Resource type", "Properties" : { Set of properties } } } "Resources" : { "MyEC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "ImageId" : "ami-2f726546" } } } Resource type is defined as AWS::AWS-PRODUCT-NAME::DATA-TYPE-NAME https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html
  • 13. Mahesh TR { .... "Resources" : { "EC2Instance" : { "Type": "AWS::EC2::Instance", "Properties" : { ... } } } } { ……. “Resources” "EC2Instance" : { "Type": "AWS::EC2::Instance", "Properties" : { “ImageID”: “ami-bff43rcd”, “InstanceType” : “t2.nano”, "SecurityGroups": “sg-546hgul” } } }
  • 15. Mahesh TR { ……. “Resources” "EC2Instance" : { "Type": "AWS::EC2::Instance", "Properties" : { “ImageID”: “ami-bff43rcd”, "SecurityGroup": “sg-546hgul”, “InstanceType” : “t2.nano” } } } { "Resources": { "Ec2Instance": { "Type": "AWS::EC2::Instance", "Properties": { “ImageID”: “ami-bff43rcd”, “SecurityGroups": [{"Ref": "InstanceSecurityGroup"}], “InstanceType” : “t2.nano” } }, "InstanceSecurityGroup": { "Type": "AWS::EC2::SecurityGroup", "Properties": { "GroupDescription": "Enable SSH access via port 22", "SecurityGroupIngress": [ { "IpProtocol": "tcp", "FromPort": "22", "ToPort": "22", "CidrIp": "0.0.0.0/0" } ] } } } { "AWSTempletFormatVersion" : "2010-09-09", "Description" : "Test Demo Server" "Resources" : { "EC2Instance" : { ... }, “InstanceSecurityGroup" : { ... } } } 1 2
  • 16. Mahesh TR"Resources" : { "Logical ID" : { "Type" : "Resource type", "Properties" : { Set of properties } } } ✓ AWS::S3::Bucket ✓ AWS::EC2::Instance ✓ AWS::EC2::Route ✓ AWS::EC2::Subnet ✓ AWS::EC2::VPC ✓ AWS::EMR::Cluster ✓ AWS::Lambda::Function ✓ AWS::RDS::DBInstance ✓ AWS::SNS::Topic { ……. “Resources” "EC2Instance" : { "Type": "AWS::EC2::Instance", "Properties" : { “ImageID”: “ami-bff43rcd”, "SecurityGroup": “sg-546hgul”, “InstanceType” : “t2.nano” } } } Type Property "Resources": { "Ec2Instance": { "Type": "AWS::EC2::Instance", "Properties": { “SecurityGroups": [{"Ref": "InstanceSecurityGroup"}], } }, "InstanceSecurityGroup": {…….. } } Refer resource to resource
  • 17. Mahesh TR X AWSTemplateFormatVersion X Description – Parameters – Mappings X Resources --- Bucket and Instance creation – Outputs
  • 19. Mahesh TR Parameter Syntax "Parameters" : { "ParameterLogicalID" : { "Type" : "DataType", "Parameter" : "value" } } "Parameters" : { "InstanceType" : { "Type" : "String", "Default" : "t2.micro", "Description" : "Type of EC2 instance to launch" } } Example
  • 20. Mahesh TR Parameter Syntax "Parameters" : { "InstanceType" : { "Type" : "String", "Default" : "t2.micro", "Description" : "Type of EC2 instance to launch" } } "Parameters" : { "InstanceType" : { "Type" : "String", "Default" : "t2.micro", "AllowedValues" : ["t2.micro", "m1.small", "m1.large"], "Description" : "Type of EC2 instance to launch" } }
  • 21. Mahesh TR Parameter Syntax "Parameters" : { "InstanceType" : { "Type" : "String", "Default" : "t2.micro", "AllowedValues" : ["t2.micro", "m1.small", "m1.large"], "Description" : "Type of EC2 instance to launch" } } "Parameters" : { "KeyPairName": { "Description" : "Name of an existing Amazon EC2 key pair", "Type": "String", }, "InstanceType": { "Description" : "Amazon EC2 instance type", "Type": "String", } }
  • 22. Mahesh TR Refer input parameter to Resources "Parameters" : { "KeyPairName": { "Description" : "Name of an existing Amazon EC2 key pair", "Type": "String", }, "InstanceType": { "Description" : "Amazon EC2 instance type", "Type": "String", } } "Resources" : { "EC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "InstanceType" : { "Ref" : "InstanceType" }, "ImageId" : { "Ref" : "AMIImageId" }, "KeyName" : { "Ref" : "KeyName" } } } }
  • 26. Mahesh TR X AWSTemplateFormatVersion X Description X Parameters – keypair, instance type, etc .. – Mappings X Resources -- Bucket and Instance creation – Outputs
  • 28. Mahesh TR Output Syntax "Outputs" : { "Logical ID" : { "Description" : "Information about the value", "Value" : "Value to return", } } "Outputs" : { "InstanceID" : { "Description": "The Instance ID", "Value" : { "Ref" : "EC2Instance" } } } Example
  • 30. Mahesh TR X AWSTemplateFormatVersion X Description X Parameters-- keypair, instance type, etc .. – Mappings X Resources -- Bucket and Instance creation X Outputs -- InstanceID, PublicDNS and Public IP etc…
  • 32. Mahesh TR Mapping Syntax "Mappings" : { "Mapping01" : { "Key01" : { "Name" : "Value01"}, "Key02" : { "Name" : "Value02"}, "Key03" : { "Name" : "Value03"} } } Example "Mappings" : { "RegionMap" : { "us-east-1" : { "32" : "ami-6411e20d"}, "us-west-1" : { "32" : "ami-c9c7978c"}, "eu-west-1" : { "32" : "ami-37c2f643"}, "ap-southeast-1" : { "32" : "ami-66f28c34"}, "ap-northeast-1" : { "32" : "ami-9c03a89d"} } } Basic Mapping
  • 33. Mahesh TR Mapping Syntax "Mappings" : { "RegionMap" : { "us-east-1" : { "32" : "ami-6411e20d"}, "us-west-1" : { "32" : "ami-c9c7978c"}, "eu-west-1" : { "32" : "ami-37c2f643"}, "ap-southeast-1" : { "32" : "ami-66f28c34"}, "ap-northeast-1" : { "32" : "ami-9c03a89d"} } } "RegionMap" : { "us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-7a11e213" }, "us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" }, "eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" }, "ap-southeast-1" : { "32" : "ami-66f28c34", "64" : "ami-60f28c32" }, "ap-northeast-1" : { "32" : "ami-9c03a89d", "64" : "ami-a003a8a1" } } Mapping with Multiple Values Basic Mapping
  • 34. Mahesh TR{ "AWSTemplateFormatVersion" : "2010-09-09", "Mappings" : { "RegionMap" : { "us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-7a11e213" }, "us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" }, "eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" } } }, "Resources" : { "myEC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "32"]}, "InstanceType" : "m1.small" } } } } Return a Value from a Mapping { "Fn::FindInMap" : [ "MapName", "TopLevelKey", "SecondLevelKey"] }
  • 35. Mahesh TR{ "Parameters" : { "EnvironmentType": { "Description": "The environment type", "Type": "String", "Default": "test", "AllowedValues": ["prod", "test"], "ConstraintDescription": "must be a prod or test" } }, "Mappings" : { "RegionAndInstanceTypeToAMIID" : { "us-east-1": { "test": "ami-8ff710e2", "prod": "ami-f5f41398"}, "us-west-2" : { "test" : "ami-eff1028f", "prod" : "ami-d0f506b0"}, ...other regions and AMI IDs... } }, "Resources" : { ...other resources... }
  • 36. Mahesh TR X AWSTemplateFormatVersion X Description X Parameters-- keypair, instance type, etc .. X Mappings – selecting AMIs is multiple reagion X Resources -- Bucket and Instance creation Metadata and Userdata X Outputs -- InstanceID, PublicDNS and Public IP etc…
  • 37. Mahesh TR UserData/Metadata How to use Metadata ? • https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide /aws-resource-init.html#aws-resource-init-configsets Example • https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide /deploying.applications.html
  • 38. Mahesh TR Public Subnet 192.168.1.20/32 SG NACL webserversSG webserver Port Source 22 12.32.54.85/32 80 0.0.0.0/0 CIDR : 192.168.1.0/24 CIDR : 192.168.0.0/16 12.32.54.85/32 2280 Destination Target 192.168.0.0/16 Local 0.0.0.0/0 IGW Private Subnet CIDR : 192.168.2.0/24 SGNACL AppserversSG Port Source 22 192.168.1.20/32 Destination Target 192.168.0.0/16 Local 0.0.0.0/0 NAT ID Appservers Route Table 1 Route Table 2 192.168.1.40/32 SG NatSG Natserver Port Source All Traffic 192.168.2.30/32 192.168.2.30/32
  • 39. Mahesh TR DEV Account QA Account