Infrastructure as code (CF) Flashcards
CloudFormation
CloudFormation defines logical resources within templates (using YAML or JSON).
CloudFormation Stacks
what gets created from a CF template
Parameters
Template parameters accept input form console ,CL, or API
when a stack is created or updated
Template Parameters
Default, or explicit values chosen
you set the values in the template
Parameters references are used by CloudFormation to provision physical resources
Pseudo Parameters
Parameters provided by AWS based on environment when creating the stack
CloudFormation Intrinsic functions: Fn::GettAtt
GetATT can be used to retrieve any attribute associated with the resource. Most Logical resources return detailed configuration of the physical resources.
CloudFormation Intrinsic Functions
AWS CloudFormation provides several built-in functions that help you manage your stacks. Use intrinsic functions in your templates to assign values to properties that are not available until runtime.
CloudFormation Intrinsic functions: Ref
using !Ref on template or pseudo parameters returns their value. When used with logical resources-the physical ID is usually returned
CloudFormation Intrinsic functions:
Fn::Join and Fn: Split
split or join strings
CloudFormation Intrinsic functions:
Fn::GetAZs and Fn::Select
!GetAZs and !Select, a template can be made portable. Rather than explicitly specifying AZ by using intrinsic functions resources can be launched or created in AZ1 AZ2
CloudFormation Intrinsic functions:
Fn::Basse64 & Fn::Sub
Fn::Base64 accepts plaintext .. and outputs Base64 encoded text
Fn::Sub substitutes variables in the input, which their actual runtime values. In the example the instanceid attribute of the instance logical resource.
CloudFormation Conditions
created in the optional ‘conditions’ section of a template
conditions are evaluated to True or False
processed before resources are created
user the other intrinsic function AND,EQUALS,IF,NOT, OR
associated with local resources to control if they are created or not
CloudFormation Intrinsic functions:
Fn::Cider
Fn::Cider is used to generate a number of smaller CIDR ranges for subnets, from a larger VPC range
CloudFormation Mappings
Templates can contain a mapping object which contains may mappings which maps keys to values , allowing lookup
can have one key, or Top & second level
Mappings use the !FindInMap intrinsic function
Common use.. retrieve AMI for given region & architecture
CloudFormation Outputs
Templates can have an optional output section values can be declared in this section visible as outputs when using CLI or console UI.
accessible from a parent stack when using nesting. can be exported , allowing cross-stack references.