Notes based on Adrian Cantrill's course from cantrill.io and Stéphane Maarek's Udemy course.
AWS::Region
AWS::StackId
AWS::StackName
AWS::AccountId
Ref
and Fn::GetAtt
: reference a value from one logical resourceFn::Join
and Fn::Split
: join/split strings to create new onesFn::GetAZs
and Fn::Select
: get availability zones in a regions and select oneFn::IF
, And
, Equals
, Not
, Or
Fn::Base64
and Fn::Sub
: encode strings to base64, substitute replacement on variables in the textFn:Cidr
: build CIDR blocksFn::GetAZs
- returns the available AZs in region. If the region has a default VPC configured, it return the AZs which are available in the default VPCMappings
objects which can contain keys to values objectsFn::FindInMap
Mappings:
RegionMap:
us-east-1:
HVM64: 'ami-xxx'
HVMG2: 'ami-yyy'
us-east-2:
HVM64: 'ami-zzz'
HVMG2: 'ami-vvv'
Outputs
section in a template is optional Outputs:
WordPressUrl:
Description: 'description text'
Value: !Join['', 'https://', !GetAtt Instance.DNSName]
Conditions
TRUE
or FALSE
AND
, EQUALS
, IF
, NOT
, OR
Conditions:
IsProd: !Equals
- !Ref EnvType
- `prod`
DependsOn
property specify the resource on which we depend onDependsOn
can accept a single resource or a list of resourcesCREATE_COMPLETE
cfn-signal
is an utility running on the EC2 instances sending success/failure signals to CFNCreationPolicy
WaitCondition
WaitCondition
is defined as a logical resource, meaning it can have DependsOn
property. It can be used as a general progress gait in the templateWaitCondition
relies on a WaitHandle
, which is another logical resource. Its job is to generate a presigned url which can be used to send signals to WaitCondition
WaitHandle
we can pass back data to the template. This data can be retrieved using the !GetAtt WaitCondition.Data
functionAWS::CloudFormation::Stack
type which needs an url to the templateNESTEDStack.Outputs.XXX
Fn::ImportValue
intrinsic functionPassRole
AWS::CloudFormation::Init
and cfn-init
AWS::CloudFormation::Init
is part of EC2 instance logical resource. With this we can specify configurations which will be applied to the created EC2 instancecfn-init
is a desired state (WHAT we want to occur)cfn-init
can be cross-platform and idempotentcfn-init
helper script which should be installed on the instancecfn-hup
cfn-init
is a helper tool running once as part of bootstrapping (user data)AWS::CloudFormation::Init
is updated, cfn-init
is not reruncfn-hup
is a helper tool which can be installed on EC2 instancescfn-init
if necessary