CloudFormation Flashcards

1
Q

What is CloudFormation?

A

CloudFormation is a declarative way of outlining your AWS Infrastructure, for any resources (most of them are supported).

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

In what order does CloudFormation create the resources defined in the stack?

A

The order in the file is not important. CloudFormation creates the resources for you in the right order with the exact configuration that you specify

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

What is provided by CloudFormation to help you with cost insights?

A

Each resource within the stack is tagged with an identifier so you can easily see how much a stack costs you

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

What saving strategy can you use in CloudFormation?

A

In Dev i.e., you could automation deletion of templates at 5 PM and recreated at 8 AM, safely

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

Where are CloudFormation templates stored?

A

In S3

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

What you need to do to update a CloudFormation template?

A

To update a template, we can’t edit previous ones. We have to reupload a new version of the template to AWS

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

What happens when you delete a CloudFormation stack?

A

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

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

What are the CloudFormation template components?

A
  • Resources
  • Parameters
  • Mappings
  • Outputs
  • Conditionals
  • Metadata
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the CloudFormation template helpers?

A
  • References

- Functions

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

What CloudFormation component is mandatory?

A

Resources

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

What is CloudFormation Resource identifiers format?

A

AWS::aws-product-name::data-type-name

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

What is a CloudFormation Resource?

A
  • Resources are the core of your CloudFormation template (MANDATORY)
  • They represent the different AWS Components that will be created and configured
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Can I create a dynamic amount of resources in CloudFormation?

A

No, you can’t. Everything in the CloudFormation template has to be declared. You can’t perform code generation there

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

Is every AWS Service supported by CloudFormation?

A

o Almost. Only a select few niches are not there yet

o 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
15
Q

What is a CloudFormation Parameter?

A

Parameters are a way to provide inputs to your AWS CloudFormation template

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

How many times can you use a CloudFormation Parameter?

A

Parameters can be used anywhere in a template

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

If a CloudFormation resource configuration is likely to change in the future, what you should do?

A

make it a parameter, you won’t have to re-upload a template to change its content

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

What can you use if some inputs cannot be determined ahead of time in CloudFormation?

A

parameters

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

How can you prevent errors from happening in your CloudFormation Parameters?

A

Using types

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

What are the CloudFormation Parameter’s types?

A
o	String
o	Number
o	CommaDelimitedList
o	List
o	AWS Parameter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What are CloudFormation Pseudo Parameters?

A
  • AWS offers us pseudo parameters in any CloudFormation template.
  • These can be used at any time and are enabled by default
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are most important CloudFormation Pseudo Parameters?

A
  • accountId
  • region
  • stackId
  • stackName
23
Q

What is a CloudFormation Mapping?

A
  • Mappings are fixed, hardcoded variables within your CloudFormation Template.
  • They’re very handy to differentiate between different environments (dev vs prod), regions (AWS regions), AMI types, etc.
24
Q

When would you use CloudFormation mappings vs parameters?

A
•	Mappings are great when you know in advance all the values that can be taken and that they can be deduced from variables such as
o	Region
o	Availability Zone
o	AWS Account
o	Environment (dev vs prod)
o	Etc…
25
Q

What is a CloudFormation Output?

A

The Outputs section declares optional outputs values that we can import into other stacks

26
Q

What you must do in your CloudFormation Output to allow another another stack to import it?

A

Define the Export key which it is optional, but without it you will not be able to import this resource in another template

27
Q

In what case could be very useful to define CloudFormation Outputs?

A

They’re very useful for example if you define a network CloudFormation, and output the variables such as VPC ID and your Subnet IDs

28
Q

When you could not delete a CloudFormation stack?

A

You can’t delete a CloudFormation Stack if its outputs are being referenced by another CloudFormation stack

29
Q

What is a CloudFormation Condition?

A

Conditions are used to control the creation of resources or outputs based on a condition

30
Q

What are common CloudFormation Conditions?

A

Conditions can be whatever you want them to be, but common ones are:
o Environment (dev / test / prod)
o AWS Region
o Any parameter value

31
Q

What can be referenced by a CloudFormation Condition?

A

Each condition can reference another condition, parameter value or mapping

32
Q

What are the CloudFormation Condition functions?

A
The intrinsic function (logical) can be any of the following:
o	Fn::And
o	Fn::Equals
o	Fn::If
o	Fn::Not
o	Fn::Or
33
Q

What can be applied to CloudFormation Conditions?

A

Conditions can be applied to resources / outputs / etc…

34
Q

What are the CloudFormation must known intrinsic Functions?

A
  • Fn::Ref
  • Fn::GetAtt
  • Fn::FindInMap
  • Fn::ImportValue
  • Fn::Join
  • Fn::Sub
  • Condition Functions
35
Q

What is for the CloudFormation function Fn::Ref?

A

The Fn::Ref function can be leveraged to reference
o Parameters
o Resources

36
Q

What is returned when your use the function !ref to reference a resource in CloudFormation?

A

returns the physical ID of the underlying resource (ex: EC2 ID)

37
Q

What is for the CloudFormation function Fn::GetAtt?

A

Attributes of another resources can be attached to any resources you create, i.e.:
!GetAtt RESOURCE_NAME.AvailabilityZone

38
Q

What is for the CloudFormation function Fn::FindInMap?

A

We use Fn::FindInMap to access Maping values to return a named value from a specific key

39
Q

What is the CloudFormation function Fn::FindInMap nomenclature?

A
  • !FindInMap [ MapName, TopLevelKey, SecondLevelKey ]
40
Q

Explain how does work the CloudFormation function Fn::FindInMap

A

Supposing you have this:
Mappings:
— RegionMap:
—— us-east-1:
——— “32”: “ami-43jn34k”
——— “64”: “ami-fwfweke”
—— us-west-1

You can use
- !FindInMap [RegionMap, !Ref “AWS::Region”, 32]

41
Q

What is for the CloudFormation function Fn::ImportValue?

A

To Import values that are exported in other templates

42
Q

What is for the CloudFormation function Fn::Join?

A

Join values with a delimiter

43
Q

What is the CloudFormation function Fn::Join nomenclature?

A
  • !Join [delimiter, [comma-delimited list of values]]

- !Join [”:”, [a,b,c]] = a:b:c

44
Q

What is for the CloudFormation function Fn::Sub?

A

Is used to substitute variables from a text. String must contain ${VariableName} and will substitute them

45
Q

What happens when a CloudFormation Stack Creation Fails?

A

everything rolls back (gets deleted). We can look at the log

46
Q

What can you do to troubleshoot a CloudFormation Stack Creation Fail?

A

Option to disable rollback and troubleshoot what happened

47
Q

What happens when a CloudFormation Stack Update Fails?

A

The stack automatically rolls back to the previous known working state. Ability to see in the log what happened and error messages

48
Q

When you update a CloudFormation stack, you need to know what changes before it happens for greater confidence, what helps you with it?

A

ChangeSets

49
Q

What will not help you with a CloudFormation ChangeSet?

A

won’t say if the update will be successful

50
Q

What are and what allow you to do CloudFormation Nested Stacks?

A
  • Nested stacks are stacks as part of other stacks

* They allow you to isolate repeated patterns / common components in separate stacks and call them from other stacks

51
Q

What you must do to update CloudFormation Nested Stack?

A

To update a nested stack, always update the parent (root stack)

52
Q

When you use CloudFormation Cross vs Nested Stacks?

A

Cross Stacks
o Helpful when stacks have different lifecycles
o Use Outputs Export and Fn::ImportValue
o When you need to pass export values to many stacks (VPC Id, etc.…)
Nested Stacks
o Helpful when components must be re-used
o Ex: re-use how to properly configure an Application Load Balancer
o The nested stack only is important to the higher-level stack (it’s not shared)

53
Q

What is a CloudFormation StackSet?

A

Create, update, or delete stacks across multiple accounts and regions with a single operation