CloudFormation Flashcards

1
Q

What is the Infrastructure as Code in AWS?

IaC

A

AWS CloudFormation

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

What does infrastructure as code mean?

A

Managing and provisioning data centers through machine readable definition files

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

Does CloudFormation cost anything to use?

A

No, The services it provisions does cost money.

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

Which 2 formats are supported for creating CloudFormation templates?

A

JSON

YAML

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

The section of a Cloudformation template that contains the AWS components being created

A

Resources

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

What is the minimum number of resources you can define in a CloudFormation template?

A

1

CloudFormation Templates requires you to at least list one resource.

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

Values that should be returned after deploying a CloudFormation template should be defined in what section?

A

Outputs

Values that returned eg. an ip-address of new server created.

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

Values that should be returned after deploying a CloudFormation template should be defined in what section?

A

Outputs

Values that returned eg. an ip-address of new server created.

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

A collection of CloudFormation templates ready to launch on AWS

A

AWS QuickStart

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

Who creates and provides AWS Quickstarts?

A

AWS solutions architects and 3rd party partners

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

The 3 types of Cloud Formation stack updates

A

Update with no interruption
Update with some interruption
Replacement

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

The 3 types of Cloud Formation stack updates

A

Update with no interruption (Without change resource’s physical ID)

Update with some interruption (Retain resource’s physical ID)

Replacement (It changes the resource’s physical ID)

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

What are 2 reasons that you might want to prevent stack updates?

A

Prevent data loss

Prevent interruption to service

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

What are 2 benefits of using NestedStacks?

A

Reduces complexity of larger templates

Makes templates more re-usable

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

When using NestedStacks where must you store the nested template files?

A

S3 Bucket

It’s a .template

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

This CloudFormation feature allows you to reference other templates inside your own template

A

Nested Stacks

ˈnɛstəd stæks

17
Q

When creating a stack via the CLI which option would you provide to disable the automatic rollback feature?

A

–ignore-rollback

18
Q

When you ___, ___ or ___, a stack, you can encounter and error and CloudFormation will attempt to rollback your stack to its previous state.

Eg.
Template Syntax Error
Try deleting a Resource which No longer exists

A

Create
Destroy
Update

19
Q

In CloudFormation “Drift” is considered when this occurs

A

The current stacks configuration differs from what CloudFormation expects it to be

20
Q

When detecting drift with NestedStacks where do you need to run the drift detection?

A

On each nested stack

21
Q

What are common causes of drift in CloudFormation?

Two common causes

A

Deleting resources

Developers modifying resources directly

22
Q

In Cloud Formation, What is when your stack’s actual configuration differs by what CloudFormation Expects.

A

Drift

It Has drifted

23
Q

In CloudFormation you can use Pseudo Parameters, if you want to have the value “us-east-1” in your Template, what do you have to write?

A

!REF “ASW::Region”

24
Q

Resource Attributes In CloudFormation allows you to add policies, what are some policies you can set?

There are 5

A
  • CreationPolicy (Success signals)
  • DeletionPolicy (If you delete an RDS, delete, retain, snapshot)
  • UpdatePolicy (ASG, ECache, Lambda Alias)
  • UpdateReplacePolicy (If you update an RDS, delete, retain…)
  • DependsOn (Resources that depends on others)

CreationPolicy
Use this attribute when you want to wait on resource configuration actions before stack creation proceeds. For example, if you install and configure software applications on an EC2 instance, you might want those applications to be running before proceeding. In such cases, you can add a CreationPolicy attribute to the instance, and then send a success signal to the instance after the applications are installed and configured

DeletionPolicy
With this attribute you can preserve or (in some cases) backup a resource when its stack is deleted. You specify a DeletionPolicy attribute for each resource that you want to control. If a resource has no DeletionPolicy attribute, AWS CloudFormation deletes the resource by default.

UpdatePolicy
Use the UpdatePolicy attribute to specify how AWS CloudFormation handles updates to the

UpdateReplacePolicy
Use the UpdateReplacePolicy attribute to retain or (in some cases) backup the existing physical instance of a resource when it is replaced during a stack update operation.

DependsOn
With this attribute you can specify that the creation of a specific resource follows another. When you add a DependsOn attribute to a resource, that resource is created only after the creation of the resource specified in the DependsOn attribute.

25
Q

This CloudFormation feature lets you assign values to properties that are not available until runtime

A

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.

26
Q

In CloudFormation Fn:GetAtt and Fn:Sub are common examples of these

And also:
    Fn::Base64
    Fn::Cidr
    Condition functions
    Fn::FindInMap
    Fn::GetAtt
    Fn::GetAZs
    Fn::ImportValue
    Fn::Join
    Fn::Select
    Fn::Split
    Fn::Sub
    Fn::Transform
    Ref
A

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.

You can use intrinsic functions only in specific parts of a template. Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes. You can also use intrinsic functions to conditionally create stack resources.

27
Q

This common Cloud Formation intrinsic function lets you select various attributes from a specific AWS resource

A

Fn:GetAtt

{ “Fn::GetAtt” : [ “logicalNameOfResource”, “attributeName” ] }

28
Q

What is CDK

A

Cloud Development Kit

Its an open source software development framework to define your cloud application resources using familiar programming languages.

Imperative Infrastructure

  • More Flexible
  • Less certain
  • Write Less
29
Q

You can write IaC using your favorite language with this

A

CDK
Cloud Development Kit
Imperative Infrastructure

  • More Flexible
  • Less certain
  • Write Less
30
Q

In CloudFormation, Stack Updates can be performed two different ways

A
  • Direct Update (Submit and it deploys)

- Executing changes set (Preview and decide if deploy)

31
Q

What are the 8 sections you cand find in a CloudFormation template?

A
  • Metadata (Additional information)
  • Description (What this template is supposed to do)
  • Parameters (Values to pass at runtime)
  • Mapping (Key-values to use in the template)
  • Conditions (It’s true it creates the resource or output)
  • Transform (Macros, SAM)
  • Resources (EC2, Lambda, RDS, Lambda)
  • Outputs (Values returned)
32
Q

What is CloudFormation?

What are its 9 components?

A
  • CloudFormation is the Infrastructure as Code (IaC) powered by AWS and it automates the provisioning of resources
  • NestedStacks (Break up the template)
  • Template Sections (Metadata, description, parameters..)
  • Stack Updates (Direct updates, Change sets)
  • Update circumstances (With no interruption…)
  • Intrinsic functions (Ref for pseudo…, Fn:…)
  • Pseudo parameters (!Ref “AWS::Region”…)
  • Drift detection (Differences)
  • Resource attributes (Creation policy, Deletion policy…)
  • SAM
33
Q

In CloudFormation CLI
The command uploads local artifacts, such as source code for an AWS Lambda function or a Swagger file for an AWS API Gateway REST API, to an S3 bucket.

A

aws cloudformation package –template-file /path_to_template/template.json –s3-bucket bucket-name –output-template-file packaged-template.json