DevOps Flashcards

1
Q

What are Cloudformation Resources ?

A

Resources are the core of Cloudformation and only mandatory section of the template. They represent different AWS components that will be created and configured in AWS.

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

What are Cloudformation Parameters ? How do we decide when to choose a parameter

A

Parameters a way to provide an input to a Cloudformation template. We should ask ourselves if a configuration is going to be changed in future, if yes we should create it as a parameter.

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

Provide few examples of Cloudformation Parameters

A

Some examples are
1. AllowedValues - allows the users to choose from a list of predefined values
2. NoEcho: true/false - whether a parameter values should be displayed or not like the DB password

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

How can we reference a Cloudformation parameter ?

A

We can reference a Cloudformation parameter using a function called !Ref which can be referenced anywhere in the template

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

What are Pseudo Parameters in a Cloudformation Template ? Provide few examples

A

Pseudo parameters are AWS parameters offered by AWS. For example, AWS::AccountId returns the current account id, AWS::Region returns the region etc

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

What are Cloudformation Mappings ?

A

Cloudformation mappings are hardcoded fixed values within a template in the form of Maps. They are handy to differentiate between different values like environments, regions etc

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

What are Cloudformation Outputs and how they are used ?

A

Cloudformation Outputs are a way to import an output from another Cloudformation stack into the current stack. We use EXPORT block and !ImportValue function to perform the same.

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

What are Cloudformation conditions and how to use them ?

A

Cloudformation Conditions allow us to write conditional blocks for example create resources based on env Dev Vs Prod

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

What are intrinsic functions ? Whats the use of intrinsic functions such as Ref, GetAtt, FindInMap, ImportValue, Base64 and various Conditional functions

A

Intrinsic functions are functions provided by AWS. Some of the important functions are:
1. Ref - Used to reference another resource inside a CF template, returns the value of a parameter or a resource
2. GetAtt - Used to provide more information about a attribute. Ref returns a reference to that resource, but GetAtt prvoides more details of various attributes of that resource
3. FindInMap - Get a value from a map by providing a key
4. ImportValue - To import an output of another EXPORT block
5. Base64 - We provide a string value in front of that function and it encodes that value using Base64 encoding
6. Conditions functions - Used to write conditional blocks, for example, AND, EQUALS, IF, NOT, OR etc

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

What are various rollback options while using a Cloudformation template. How to retrigger after fixing the issues manually after rollback ?

A

There are two options to rollback
1. Stack creation fails - Everything rollbacks
2. Stack update fails - Everything rollbacks to previous known state

After fixing the issues manually, issue ContinueUpdateRollback API from console or continue-update-rollback from the CLI to retrigger creation or update the stacks

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

What is Cloudformation Service role ?

A

It’s an IAM role to allow CF to create/update/delete resources on our behalf, in case we dont have permissions to create, update or delete the resource directly

User must have iam::PassRole permissions

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

What are Cloudformation Capabilities and various types of CF capabilities ? What exception is thrown when we dont have the necessary CF capabilities ?

A

These are capabilities you need to give to CF in order to create/update/delete resources. Two types
1. CAPABILITY_NAMED_IAM and CAPABILITY_IAM - create/update/delete IAM resources like user or group creation etc.
2. CAPABILITY_AUTO_EXPAND - when template have nested staks and CF is going to created resources dynamically.

So we are acknowledging that CF can create these type of resources. If CF is nor provided these capabilities then it will throw InsufficientCapabilitiesException

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

What is Cloudformation Deletion policy and what are various types ?

A

Controls what happens when a resource is delete from stack or when a resource is removed from a CF template.

  1. Default value of this policy is “DeletionPolicy=Delete” (only exception is when we delete a S3 bucket but its not empty, in that case the bucket wont get deleted)
  2. “DeletionPolicy=Retain” - to retain a resource when a CF is deleted like in case of DynamoDB, for instance
  3. “DeletionPolicy=Snapshot” - Take a final snapshot before the resource is deleted from CF, for example EBS volumes, RDS instances etc
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is Cloudformation Stack policy ?

A

It’s a JSON document that specifies what updates are allowed on a stack during CF update. For example, allow updates on resources in all env except the ProductionDatabase resource

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

How can we prevent the accidental deletes of Cloudformation stacks ?

A

We can enable a feature called Termination Protection for Cloudformation Stacks

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

What are Cloud Formation Custom Resources used for ? Provide an example

A

Custom Resources are used for following
1. Define resources not yet supported by CF
2. Define custom provisioning logic that are outside of CF like on-premise resources and 3rd party resources
3. Have custom scripts run during create/update/delete through Lambda functions

Let’s suppose we need to delete a S3 bucket. However we cant delete a non-empty S3 bucket through CF stack. So we can write a custom script to empty a S3 bucket before CF stack runs and deletes the bucket

17
Q

What are Cloudformation StackSets and why they are used ?

A

CF StackSets are used to create/update/delete stacks across multiple accounts and regions with a single operation and template. The StackSets are typically run from the administrator’s account.