CloudFormation Building Blocks
1) Resources - Your AWS resources declared in the template
2) Parameters: The dynamic inputs for your template.
3) Mapping: The static variables for your template
4) Outputs: Reference to what has been created.
5) Conditionals: List of conditions to perform resoruce creation
6) Metadata:
Templates Helpers:
1) References
2) Functions
{
"Description" : "A text description for the template usage",
"Parameters": {
// A set of inputs used to customize the template per deployment
},
"Resources" : {
// The set of AWS resources and relationships between them
},
"Outputs" : {
// A set of values to be made visible to the stack creator
},
"AWSTemplateFormatVersion" : "2010-09-09"
}
Special Metatdata Keys:
AWS::CloudFormation::Designer - used in aws cloudformation design - layout
AWS::CloudFormation::Interface - Group input data for AWS Console Cloudformation parameters.
AWS::CloudFormation::Init - Define configuration tasks for cfn-init
AWS::CloudFormation::Interface
AWS::CloudFormation::Init
AWS::CloudFormation::Authentication
AWS::CloudFormation::WaitConditionHandle
AWS::CloudFormation::WaitCondition
UserData:
Fn::Base64 function
CloudFormation Helper Scripts; (four python scripts part of amazon ami, if not, we can install it using yum)
cfn-init - retrieve and interpret the resource metadata
cfn-signal - talk to cf code and will say yes or no
cfn-get-metadata - wrapper script to retrieve metatdata
cfn-hup - a daemon to check for update to metadata and execute custom hook when change is detected.
usual flow:
cfn-init -> cfn-signal -> cfn-hup (optional)
/etc/cfn/
AWS::CloudFormation::Init
config:
packages
groups
users
sources
files
commands
services
config2
Properties:
Fn::Sub = !Sub
Conditions:
Logical ID;
Intrinsic function
Fn::And
Fn::Equals
Fn::If
Fn::Not
Fn::Or