SlideShare a Scribd company logo
AWS CloudFormation
Intrinsic Functions and Mappings
Managing Windows instances in the Cloud
Sponsors
Presented by Adam Book
from
Find me on LinkedIn
CloudFormation Deep Dive
CloudFormation Review
AWS CloudFormation Allows you to build Infrastructure as
code using templates which are constructed from json.
CloudFormation Template
There are 8 sections of a Cloud formation template, most
of which are optional
Format Version
(optional)
Description (optional)
Metadata (optional)
Mappings (optional)
Parameters(optional)
Conditions(optional)
Resources (required)
Outputs(optional)
CloudFormation
Best Practice
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html
As you use Cloud Formation make sure you follow the best
practices for success
• Do Not Embed Credentials in You Templates
• Use AWS-Specific Parameter Types
• Use Parameter Constraints
• Validate Templates Before Using them
• Manage All Stack Resources Through AWS Cloud Formation
CloudFormation
Intrinsic Functions
Function Overview
Fn::Base64 returns the Base64 representation of the input string (user data)
Fn::FindInMap returns the value corresponding to keys in a two-level map that is
declared in the Mappings section
Fn::GetAtt returns the value of an attribute from a resource in the template.
Fn::GetAZs returns an array that lists Availability Zones for a specified region.
Fn::Join appends a set of values into a single value, separated by the
specified delimiter.
Fn::Select returns a single object from a list of objects by index.
Ref returns the value of the specified parameter or resource.
CloudFormation
Mappings
The Mappings section is optional but is matches a
key to a corresponding set of named values.
If you want to set values based on region, you can
create a mapping that uses the key as the name and
then contains the values you want to specify for each
region.
You cannot include parameters, pseudo parameters, or intrinsic
functions in the Mappings section.
CloudFormation
Mappings - cont.
"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"}
}
}
CloudFormation
Mappings - cont.
"asgApp": {
"MinSize" : { "value": "2" },
"MaxSize" : { "value": "2" },
"DesiredCapacity" : { "value": "2" },
"HealthCheckType" : { "value": "EC2" },
"TerminationPolicies" : { "value":
"OldestInstance" }
}
CloudFormation
Mappings - cont.
"asgAppA": {
"Type": "AWS::AutoScaling::AutoScalingGroup",
"Properties": {
"AvailabilityZones" : { "Ref": "AZs" },
"VPCZoneIdentifier" : { "Ref": "PrivateAPPSubnets" },
"LaunchConfigurationName" : { "Ref": "LaunchConfig" },
"MinSize" : { "Fn::FindInMap": [ "asgApp",
"MinSize", "value" ] },
"MaxSize" : { "Fn::FindInMap": [ "asgApp",
"MaxSize", "value" ] },
"DesiredCapacity" : { "Fn::FindInMap": [ "asgApp",
"DesiredCapacity", "value" ] },
"HealthCheckType" : { "Fn::FindInMap": [ "asgApp",
"HealthCheckType", "value" ] },
"TerminationPolicies" : [{ "Fn::FindInMap": [ "asgApp",
"TerminationPolicies", "value" ] }],
Fn::FindInMap
"Resources" : {
"myEC2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" :
"AWS::Region" }, "32"]},
"InstanceType" : "m1.small" }
}
}
}
This function performs lookups, it accepts a ‘mappings’ object on of
one or two keys and then returns a value
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-findinmap.html
Fn::Base64
{ "Fn::Base64" : ”apt-get update –y " }
This function accepts plain text and converts it to Base 64
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-base64.html
Fn::Join
"Outputs" : {
"URL" : {
"Description" : "The URL of your demo website",
"Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [
"ElasticLoadBalancer", "DNSName" ]}]]}
}
}
This can be used to concatenate various components to produce
things such as a URL.
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-join.html
Fn::GetAtt
Some examples of attributes that can be called are:
• EC2 -> PrivateIp
• EC2-> PublicIp
• ElasticLoadBalancing -> DNSName
• IAM::Group -> ARN
• S3 Bucket -> DomainName
• Simple AD -> Alias
As you dynamically create items in your Cloud Formation templates ,
you may need to use some of the Attributes after they are created.
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-getatt.html
Fn::GetAtt
"MyEIP" : {
"Type" : "AWS::EC2::EIP",
"Properties" : {
"InstanceId" : { "Ref" : "MyEC2Instance" }
}
}
“Fn:GetAtt” :[ “MyEIP”, “AllocationId” ]
As you dynamically create items in your Cloud Formation templates
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-getatt.html
Fn::GetAZs
{ "Fn::GetAZs" : "us-east-1" }
{ "Fn::GetAZs" : { "Ref" : "AWS::Region" } }
The intrinsic function Ref returns to value of the specified
parameter or resource.
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-select.html
NOTE: You can use the Ref function in the Fn::GetAZz function.
Fn::Select
{ “Fn::Select” : [ “0”, {”Fn::GetAZs” : “”} ] }
Selects a single object from a list of object and can be paired with
other functions such as Fn::GetAZs
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-select.html
The output is the first Availablity zone in the region where the
template is applied.
Replacing the 0 with a 1 would select the second Availability Zone
Fn::Ref
"MyEIP" : {
"Type" : "AWS::EC2::EIP",
"Properties" : {
"InstanceId" : { "Ref" : "MyEC2Instance" }
}
}
The intrinsic function Ref returns to value of the specified
parameter or resource.
For more info
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-
reference-ref.html
Cloud Formation Templates
Real World Examples
Photo curtesy
of Stephen Radford via
http://snap.io
Questions?
Image by http://www.gratisography.com/

More Related Content

What's hot (10)

PPTX
Types of attributes (160210107054)
ajay_483
 
PDF
KPI w projektach IT
Laravel Poland MeetUp
 
PDF
Preparing students for university and career success
Hobsons
 
PDF
Database Management Systems 4 - Normalization
Nickkisha Farrell
 
PPTX
Introduction to files and db systems 1.0
Dr. C.V. Suresh Babu
 
PPS
Introduction to Data Warehousing
Jason S
 
PPTX
Sql Constraints
I L0V3 CODING DR
 
PPTX
Relational algebra in DBMS
Arafat Hossan
 
PPTX
Introduction to HiveQL
kristinferrier
 
PDF
Database System Concepts and Architecture
sontumax
 
Types of attributes (160210107054)
ajay_483
 
KPI w projektach IT
Laravel Poland MeetUp
 
Preparing students for university and career success
Hobsons
 
Database Management Systems 4 - Normalization
Nickkisha Farrell
 
Introduction to files and db systems 1.0
Dr. C.V. Suresh Babu
 
Introduction to Data Warehousing
Jason S
 
Sql Constraints
I L0V3 CODING DR
 
Relational algebra in DBMS
Arafat Hossan
 
Introduction to HiveQL
kristinferrier
 
Database System Concepts and Architecture
sontumax
 

Viewers also liked (13)

PPTX
Aws meetup managed_nat
Adam Book
 
PPTX
Aws atlanta march_2015
Adam Book
 
PPTX
Docker on AWS
Sascha Möllering
 
PPTX
Aws meetup building_lambda
Adam Book
 
PPTX
Integrate Jenkins with S3
devopsjourney
 
PPTX
AWS Atlanta meetup 2/ 2017 Redshift WLM
Adam Book
 
PDF
Test-Driven Infrastructure with CloudFormation and Cucumber.
Stelligent
 
PPTX
AWS Cloud Formation
Adam Book
 
PPTX
AWS Certification Paths And Tips for Getting Certified
Adam Book
 
PPTX
Aws Atlanta meetup Amazon Athena
Adam Book
 
PPTX
Aws meetup aws_waf
Adam Book
 
PDF
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni
 
PDF
SlideShare 101
Amit Ranjan
 
Aws meetup managed_nat
Adam Book
 
Aws atlanta march_2015
Adam Book
 
Docker on AWS
Sascha Möllering
 
Aws meetup building_lambda
Adam Book
 
Integrate Jenkins with S3
devopsjourney
 
AWS Atlanta meetup 2/ 2017 Redshift WLM
Adam Book
 
Test-Driven Infrastructure with CloudFormation and Cucumber.
Stelligent
 
AWS Cloud Formation
Adam Book
 
AWS Certification Paths And Tips for Getting Certified
Adam Book
 
Aws Atlanta meetup Amazon Athena
Adam Book
 
Aws meetup aws_waf
Adam Book
 
From development environments to production deployments with Docker, Compose,...
Jérôme Petazzoni
 
SlideShare 101
Amit Ranjan
 
Ad

Similar to AWS CloudFormation Intrinsic Functions and Mappings (20)

PPTX
AWS CloudFormation Session
Kamal Maiti
 
PPTX
Programando sua infraestrutura com o AWS CloudFormation
Amazon Web Services LATAM
 
PDF
AWS CloudFormation (February 2016)
Julien SIMON
 
PDF
AWS Cloud Formation
Mahesh Raj
 
PPTX
Introduction to aws cloud formation
Aniruddha jawanjal
 
PDF
Scalable and Fault-Tolerant Apps with AWS
Fernando Rodriguez
 
PPTX
Cloudformation101
Dave Pigliavento
 
PDF
Michael_Blum_Mastering_CloudFormation.pdf
MichaelBlum40
 
PPTX
Dev & Test on AWS - Hebrew Webinar
Boaz Ziniman
 
PDF
gcp-for-aws-professionals-presentation.pdf
gobeli2850
 
PDF
Dev & Test on AWS - Journey Through the Cloud
Ian Massingham
 
PDF
Development in the could: How do we do it(Cloud computing. Microservices. Faas)
Preply.com
 
PPTX
AWS-Architecture-Icons-Deck_For-Dark-BG_02062024.pptx
GopiNarahari1
 
PPTX
Utah Codecamp Cloud Computing
Tom Creighton
 
PPTX
Axis Collage Kanpur: AWS Cloud Formation Presentation DevOps Feb_08_2022
Varun Manik
 
PPTX
AWS Best Practices Version 2
Kenichi Shibata
 
PDF
AWS Cloud Formation: A Service Resource Management
StudySection
 
PDF
AWS CLOUDFORMATION
Riyaz-ul
 
PPTX
AWS Best Practices
Kenichi Shibata
 
PPTX
Infrastructure as Code in AWS using Cloudformation
John Reilly Pospos
 
AWS CloudFormation Session
Kamal Maiti
 
Programando sua infraestrutura com o AWS CloudFormation
Amazon Web Services LATAM
 
AWS CloudFormation (February 2016)
Julien SIMON
 
AWS Cloud Formation
Mahesh Raj
 
Introduction to aws cloud formation
Aniruddha jawanjal
 
Scalable and Fault-Tolerant Apps with AWS
Fernando Rodriguez
 
Cloudformation101
Dave Pigliavento
 
Michael_Blum_Mastering_CloudFormation.pdf
MichaelBlum40
 
Dev & Test on AWS - Hebrew Webinar
Boaz Ziniman
 
gcp-for-aws-professionals-presentation.pdf
gobeli2850
 
Dev & Test on AWS - Journey Through the Cloud
Ian Massingham
 
Development in the could: How do we do it(Cloud computing. Microservices. Faas)
Preply.com
 
AWS-Architecture-Icons-Deck_For-Dark-BG_02062024.pptx
GopiNarahari1
 
Utah Codecamp Cloud Computing
Tom Creighton
 
Axis Collage Kanpur: AWS Cloud Formation Presentation DevOps Feb_08_2022
Varun Manik
 
AWS Best Practices Version 2
Kenichi Shibata
 
AWS Cloud Formation: A Service Resource Management
StudySection
 
AWS CLOUDFORMATION
Riyaz-ul
 
AWS Best Practices
Kenichi Shibata
 
Infrastructure as Code in AWS using Cloudformation
John Reilly Pospos
 
Ad

More from Adam Book (13)

PPTX
Aws meetup control_tower
Adam Book
 
PPTX
Aws meetup s3_plus
Adam Book
 
PPTX
AWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
Adam Book
 
PPTX
AWS Atlanta meetup Build Tools - Code Commit, Code Build, Code Deploy
Adam Book
 
PPTX
AWS Atlanta Meetup - June 19 - AWS organizations - Account Structure
Adam Book
 
PPTX
Aws meetup systems_manager
Adam Book
 
PPTX
AWS Atlanta meetup Secrets Manager
Adam Book
 
PPTX
AWS Atlanta meetup load-balancing
Adam Book
 
PPTX
AWS Atlanta meetup cognit Back to Basics
Adam Book
 
PPTX
AWS Atlanta meetup CloudFormation conditionals
Adam Book
 
PPTX
Aws Atlanta meetup - Understanding AWS Config
Adam Book
 
PPTX
Aws meetup ssm
Adam Book
 
PPTX
Aws multi-region High Availability
Adam Book
 
Aws meetup control_tower
Adam Book
 
Aws meetup s3_plus
Adam Book
 
AWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
Adam Book
 
AWS Atlanta meetup Build Tools - Code Commit, Code Build, Code Deploy
Adam Book
 
AWS Atlanta Meetup - June 19 - AWS organizations - Account Structure
Adam Book
 
Aws meetup systems_manager
Adam Book
 
AWS Atlanta meetup Secrets Manager
Adam Book
 
AWS Atlanta meetup load-balancing
Adam Book
 
AWS Atlanta meetup cognit Back to Basics
Adam Book
 
AWS Atlanta meetup CloudFormation conditionals
Adam Book
 
Aws Atlanta meetup - Understanding AWS Config
Adam Book
 
Aws meetup ssm
Adam Book
 
Aws multi-region High Availability
Adam Book
 

Recently uploaded (20)

PDF
July Patch Tuesday
Ivanti
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
July Patch Tuesday
Ivanti
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 

AWS CloudFormation Intrinsic Functions and Mappings

  • 1. AWS CloudFormation Intrinsic Functions and Mappings Managing Windows instances in the Cloud
  • 3. Presented by Adam Book from Find me on LinkedIn CloudFormation Deep Dive
  • 4. CloudFormation Review AWS CloudFormation Allows you to build Infrastructure as code using templates which are constructed from json.
  • 5. CloudFormation Template There are 8 sections of a Cloud formation template, most of which are optional Format Version (optional) Description (optional) Metadata (optional) Mappings (optional) Parameters(optional) Conditions(optional) Resources (required) Outputs(optional)
  • 6. CloudFormation Best Practice For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/best-practices.html As you use Cloud Formation make sure you follow the best practices for success • Do Not Embed Credentials in You Templates • Use AWS-Specific Parameter Types • Use Parameter Constraints • Validate Templates Before Using them • Manage All Stack Resources Through AWS Cloud Formation
  • 7. CloudFormation Intrinsic Functions Function Overview Fn::Base64 returns the Base64 representation of the input string (user data) Fn::FindInMap returns the value corresponding to keys in a two-level map that is declared in the Mappings section Fn::GetAtt returns the value of an attribute from a resource in the template. Fn::GetAZs returns an array that lists Availability Zones for a specified region. Fn::Join appends a set of values into a single value, separated by the specified delimiter. Fn::Select returns a single object from a list of objects by index. Ref returns the value of the specified parameter or resource.
  • 8. CloudFormation Mappings The Mappings section is optional but is matches a key to a corresponding set of named values. If you want to set values based on region, you can create a mapping that uses the key as the name and then contains the values you want to specify for each region. You cannot include parameters, pseudo parameters, or intrinsic functions in the Mappings section.
  • 9. CloudFormation Mappings - cont. "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"} } }
  • 10. CloudFormation Mappings - cont. "asgApp": { "MinSize" : { "value": "2" }, "MaxSize" : { "value": "2" }, "DesiredCapacity" : { "value": "2" }, "HealthCheckType" : { "value": "EC2" }, "TerminationPolicies" : { "value": "OldestInstance" } }
  • 11. CloudFormation Mappings - cont. "asgAppA": { "Type": "AWS::AutoScaling::AutoScalingGroup", "Properties": { "AvailabilityZones" : { "Ref": "AZs" }, "VPCZoneIdentifier" : { "Ref": "PrivateAPPSubnets" }, "LaunchConfigurationName" : { "Ref": "LaunchConfig" }, "MinSize" : { "Fn::FindInMap": [ "asgApp", "MinSize", "value" ] }, "MaxSize" : { "Fn::FindInMap": [ "asgApp", "MaxSize", "value" ] }, "DesiredCapacity" : { "Fn::FindInMap": [ "asgApp", "DesiredCapacity", "value" ] }, "HealthCheckType" : { "Fn::FindInMap": [ "asgApp", "HealthCheckType", "value" ] }, "TerminationPolicies" : [{ "Fn::FindInMap": [ "asgApp", "TerminationPolicies", "value" ] }],
  • 12. Fn::FindInMap "Resources" : { "myEC2Instance" : { "Type" : "AWS::EC2::Instance", "Properties" : { "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "32"]}, "InstanceType" : "m1.small" } } } } This function performs lookups, it accepts a ‘mappings’ object on of one or two keys and then returns a value For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-findinmap.html
  • 13. Fn::Base64 { "Fn::Base64" : ”apt-get update –y " } This function accepts plain text and converts it to Base 64 For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-base64.html
  • 14. Fn::Join "Outputs" : { "URL" : { "Description" : "The URL of your demo website", "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]} } } This can be used to concatenate various components to produce things such as a URL. For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-join.html
  • 15. Fn::GetAtt Some examples of attributes that can be called are: • EC2 -> PrivateIp • EC2-> PublicIp • ElasticLoadBalancing -> DNSName • IAM::Group -> ARN • S3 Bucket -> DomainName • Simple AD -> Alias As you dynamically create items in your Cloud Formation templates , you may need to use some of the Attributes after they are created. For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-getatt.html
  • 16. Fn::GetAtt "MyEIP" : { "Type" : "AWS::EC2::EIP", "Properties" : { "InstanceId" : { "Ref" : "MyEC2Instance" } } } “Fn:GetAtt” :[ “MyEIP”, “AllocationId” ] As you dynamically create items in your Cloud Formation templates For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-getatt.html
  • 17. Fn::GetAZs { "Fn::GetAZs" : "us-east-1" } { "Fn::GetAZs" : { "Ref" : "AWS::Region" } } The intrinsic function Ref returns to value of the specified parameter or resource. For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-select.html NOTE: You can use the Ref function in the Fn::GetAZz function.
  • 18. Fn::Select { “Fn::Select” : [ “0”, {”Fn::GetAZs” : “”} ] } Selects a single object from a list of object and can be paired with other functions such as Fn::GetAZs For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-select.html The output is the first Availablity zone in the region where the template is applied. Replacing the 0 with a 1 would select the second Availability Zone
  • 19. Fn::Ref "MyEIP" : { "Type" : "AWS::EC2::EIP", "Properties" : { "InstanceId" : { "Ref" : "MyEC2Instance" } } } The intrinsic function Ref returns to value of the specified parameter or resource. For more info http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function- reference-ref.html
  • 20. Cloud Formation Templates Real World Examples Photo curtesy of Stephen Radford via http://snap.io

Editor's Notes

  • #5: AWS already has managed policies for SSM to attached either to your users or Roles. These can be easily found by going to to policy section of IAM and then searching for SSM
  • #6: Some sections in a template can be in any order. If you use a tool such as troposphere then the output can be placed out as Alphabetical vs logical if you are used to the templates provided by AWS
  • #7: With constraints, you can describe allowed input values so that AWS CloudFormation catches any invalid values before creating a stack. You can set constraints such as a minimum length, maximum length, and allowed patterns. For example, you can set constraints on a database user name value so that it must be a minimum length of eight character and contain only alpha-numeric characters.
  • #8: Intrinsic functions are inbuilt functions provided by AWS to help you manage, reference, and conditionally act upon resources, situations and inputs to a stack You can compare intrinsic functions to logical operations in programming such as: If – Else, Case, Switch etc
  • #9: Although the most used case with mappings is with AMI’s and bits. There are other cases where you can use mappings for quick lookups
  • #10: This example shows a Mappings section with a map RegionMap, which contains five keys that map to name-value pairs containing single string values. The keys are region names. Each name-value pair is the AMI ID for the 32-bit AMI in the region represented by the key.
  • #11: This example shows a Mappings section with a map RegionMap, which contains five keys that map to name-value pairs containing single string values. The keys are region names. Each name-value pair is the AMI ID for the 32-bit AMI in the region represented by the key.
  • #12: This example shows a Mappings section being used in an autoscale group.
  • #14: Its useful when other elements in a stack need Base 64 input such as EC2 user data
  • #15: One of the best uses of the Join is in the output section and to produce the output endpoint for your users.
  • #16: Remember to include the DependsOn piece in your resources if you downstream resources needs the attribute of a previously created resource
  • #20: This is probably the most useful and easiest of the Intrinsic functions I’ve found to date.