aws cloudformation intrinsic functions and mappings

21
AWS CloudFormation Intrinsic Functions and Mappings Managing Windows instances in the Cloud

Upload: adam-book

Post on 12-Jan-2017

475 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: AWS CloudFormation Intrinsic Functions and Mappings

AWS CloudFormationIntrinsic Functions and Mappings

Managing Windows instances in the Cloud

Page 2: AWS CloudFormation Intrinsic Functions and Mappings

Sponsors

Page 3: AWS CloudFormation Intrinsic Functions and Mappings

Presented by Adam Book from

Find me on LinkedIn

CloudFormation Deep Dive

Page 4: AWS CloudFormation Intrinsic Functions and Mappings

CloudFormation Review

AWS CloudFormation Allows you to build Infrastructure as code using templates which are constructed from json.

Page 5: AWS CloudFormation Intrinsic Functions and Mappings

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)

Page 7: AWS CloudFormation Intrinsic Functions and Mappings

CloudFormationIntrinsic FunctionsFunction OverviewFn::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.

Page 8: AWS CloudFormation Intrinsic Functions and Mappings

CloudFormationMappings

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.

Page 9: AWS CloudFormation Intrinsic Functions and Mappings

CloudFormationMappings - 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"} } }

Page 10: AWS CloudFormation Intrinsic Functions and Mappings

CloudFormationMappings - cont. "asgApp": { "MinSize" : { "value": "2" }, "MaxSize" : { "value": "2" }, "DesiredCapacity" : { "value": "2" }, "HealthCheckType" : { "value": "EC2" }, "TerminationPolicies" : { "value": "OldestInstance" } }

Page 11: AWS CloudFormation Intrinsic Functions and Mappings

CloudFormationMappings - 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" ] }],

Page 20: AWS CloudFormation Intrinsic Functions and Mappings

Cloud Formation Templates Real World Examples

Photo curtesyof Stephen Radford via http://snap.io

Page 21: AWS CloudFormation Intrinsic Functions and Mappings

Questions?

Image by http://www.gratisography.com/