CloudFormation Flashcards

1
Q

What is CloudFormation?

A
  • Infrastructure as Code
  • Code that can be deployed and is written to create / update / delete infrastructure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is there a cost for using CloudFormation?

A

No. Only the underlying services.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

High Level - How does CloudFormation work?

A
  • Templates have to be uploaded in S3 and then referenced in CloudFormation.
  • To update a template, a new version must be uploaded to AWS (cannot edit existing one directly).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 2 main ways to deploy CloudFormation templates?

A
  • Manually
  • Automated (recommended)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe manual deploys in CloudFormation

A
  • Edit templates in the CloudFormation designer
  • Use the console to input parameters etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe the high level overview of deploying CloudFormation through automation.

A
  • Edit templates in a YAML file.
  • Use the AWS CLI to deploy the templates.
  • Recommended way in order to fully automate flow.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List the 6 main building blocks for CloudFormation.

A
  1. Resources (Required)
  2. Parameters
  3. Mappings
  4. Outputs
  5. Conditionals
  6. Metadata
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The exam will not expect you to write CloudFormation templates, but it will expect you to be able to READ CloudFormation templates. What language should you be familar with so that you can read and understand CloudFormation?

A

YAML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can Resources be dynamically created using CloudFormation?

A

No. Resources in the CloudFormation Template must be declared.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Is every AWS resource supported through CloudFormation.

A

No, but almost. Mostly smaller services that are not yet addressed and you can work around that using AWS Lambda Custom Resources.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are CloudFormation parameters?

A
  • Parameters are a way to provide inputs to your AWS CloudFormation templates.
  • Parameters are extremely powerful, controlled, and can prevent errors from happening in your templates thats to types.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When should you use CloudFormation parameters?

A
  • If the CloudFormation resource is likely to change in the future.
  • By making a parameter you will not have to re-load a template to change its content.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you reference a parameter in CloudFormation?

A
  • The Fn::Ref function can be leverage to reference parameters.
    • The shorthand for this in YAML is !Ref
  • Parameters can be referenced anywhere in the template.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How can you get the account ID using a CloudFormation template?

A
  • CloudFormation has something called pseudo parameters.
  • These can be used at anytime and are enabled by default.
  • One of these pseudo parameters in AWS::AccountId
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are CloudFormation Mappings?

A
  • Mapping are fixed variables with the CloudFormation template.
  • Handy to differentiate between different environments (dev vs prod), regions, AMI types etc.
  • All values are hardcoded in the template.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the difference between CloudFormation parameters & mappings?

A

Use Mapping when you know values in advanced and reosurces will most likely NOT change. Those values can be turned into variables (region, AMI, enviroment etc. ).

Use Parameters when a resource configuration is likely to change in the future.

17
Q

What happens if you delete a stack created by CloudFormation?

A

Deleting a stack deletes every single artifact that was created by
CloudFormation.

18
Q

How are CloudFormation stacks identified?

A

Stacks are identified by a name.

19
Q

What are CloudFormation outputs?

A
  • The outputs section in a CloudFormation template declares optional outputs that must first be exported and then can be imported into other stacks.
  • Allows for collaboration across stacks.
20
Q

What happens if you delete a stack that has declared exported outputs?

A

That stack cannot be deleted as long as exported outputs are being used in other stacks.

21
Q

What is a CloudFormation Cross Stack Reference?

A

When a stack references the output(s) of another stack.

22
Q

How are CloudFormation outputs imported into another stack?

A
  • Fn::ImportValue
  • In YAML this is : !ImportValue [Value Variable Name]
23
Q

How are conditions used in CloudFormation?

A
  • Conditions are used to control the create of resources or outputs.
  • Example: Conditions can be based on Environment, Region etc.
24
Q

Hoe are conditions defined in CloudFormation?

A

There is a conditions section the YAML file that can use any common logical operators.

25
Q

What are the five conditional (logical) operators that can be used in CloudFormation?

A
  • Fn::And
  • Fn::Equals
  • Fn::If
  • Fn::Not
  • Fn::Or
26
Q

Other then CloudFormation conditional values, what are six Instrinic functions to know?

A

All six are prepended with Fn::

  • Ref
  • GetAtt
  • FindInMap
  • ImportValue
  • Join
  • Sub
27
Q

Fn::Ref

A
  • References a parameter (returns the value of the paramter) or
  • references a resource (returns the physical ID of the underlying resource.
  • YAML = !Ref
28
Q

Fn::GetAtt

A
  • Returns a value for a specified attribute of the defined type.
  • Example for EC2 you can to Fn::GetAtt AvailabilityZone
29
Q

Fn::FindInMap

A
  • Accesses mapped values - returns a named value from a specific key
  • YAML = !FindInMap
30
Q

Fn::ImportValue

A
  • Import values are values that have been exported from another CloudFormation template.
  • YAML = !ImportValues
31
Q

Fn::Join

A

Join values with a delimiter

Example:

!Join [”:” , [a,b,c] ] returns ‘a:b:c’

32
Q

Fn::Sub

A
  • Used to substitute variable from text.
  • Allows you to fully customize your templates.
  • YAML = !Sub
33
Q

What is a cross stack and when are they useful?

A
  • Cross-stack references let you use a layered or service-oriented architecture. Instead of including all resources in a single stack, you create related AWS resources in separate stacks; then you can refer to required resource outputs from other stacks.. (Example, VPC stack, ELB Stack etc.).
  • Helpful when stacks have different lifecycles.
  • Use outputs export and importValue.
34
Q

In CloudFormation, what is a nested stack, and when are they useful?

A
  • Nested stacks are stacks created as part of other stacks.
  • You create a nested stack within another stack by using the AWS::CloudFormation::Stack resource.
  • Helpful when components must be reused
35
Q

In CloudFormation, what are StackSets?

A
  • StackSets all you to create, update, or delete stacks across multiple accounts and regions with a single operation.
  • When you update a stack set, all associated stack instances are updated throughout all accounts and regions.