Chapter 8 Infrastructure as Code Flashcards

1
Q

Two major benefits of using CloudFormation

A

Your infrastructure is now repeatable and versionable

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

Why should you NOT manually update resources outside of AWS CloudFormation?

A

Inconsistencies b/w state CloudFormation expects and actual resource state. Can cause future stack failures.

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

What is a ‘change set’ in CloudFormation?

A

A description of changes that will occur on a stack, if a template is submitted. If the changes are acceptable, change set itself can execute on the stack and implement proposed modifications. Important when dealing with potential data loss.

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

Additional benefit of using a service role in CloudFormation

A

it will extend the default timeout for stack create, update, and delete actions

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

If there is a need to restrict what permissions a single IAM user or AWS role can have, you can provide a…

A

service role the stack uses for the create, update, or delete actions.

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

In order to submit a local file as a template in CloudFormation, what must you do. Why?

A

Add S3 related permissions (createBucket, putObject, etc.) to the CloudFormation service role. Reason is that templates are stored/pulled from S3.

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

What is a pseudo parameter in CloudFormation?

A

Used within template. Parameter that AWS defines on your behalf. Example: ‘AWS::Region’

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

Equivalent of NULL in CloudFormation templates

A

AWS::NoValue

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

What are Transforms in CloudFormation

A

Reusable macros (functions really) that transform template based on logic of transform function. “stuff you want to do to your template before launching it”

  • Can isolate where in template macro execute via ‘Fn::Transform’
  • Used commonly for SAM (extension of CloudFormation syntax)
  • Used commonly for including other templates vis snippets pulled from S3
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

In CloudFormation, what happens when an update fails?

A

AWS rolls back your stack to previous state.

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

3 days CloudFormation updates resources

A
  1. No interruption
  2. Some interruption
  3. Replacement (i.e. ec2 instance)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

9 unique sections of template

A
  1. AWSTemplateFormatVersion (there’s only 1 version)
  2. Description
  3. Metadata
  4. Parameters
  5. Mappings
  6. Conditions
  7. Transform
  8. Resources
  9. Outputs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the purpose/process of Output in CloudFormation?

A

This is a top level property in a template. It allows you to export some value that any other stack has access to.

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

How can a template be transformed?

A

Via a template snippet pulled from S3 or by lambda function

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

In CloudFormation how do you resolve values that cannot be determined until input into a template stack is created?

A

intrinsic functions

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

How are custom resources applied in CF?

A

via Lambda or SNS topics

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

In order for a custom resource to be successful, what must happen?

A

resource provider must return success response to presigned S3 URL you provide in request

18
Q

How to ensure that creation of resource should not begin until another one completes?

A

use the ‘DependsOn’ attribute

19
Q

What is ‘Creation Policy’ in CF?

A

it instructs CF not to mark resource as CREATE_COMPLETE until resource itself signals back to service

20
Q

Alternative to Creation Policy in CF

A

WaitCondition. Based on arbitrary pauses. Should create a new WaitCondition for each update.

21
Q

Stack actions all linked to CloudTrail via a single…

A

ClientRequestToken

22
Q

T/F: Physical ID or resource changes if resource is replaced.

A

True

23
Q

What is additional fail safe to prevent accidental updates to critical resources in CF?

A

stack policies - cannot be removed, only replaced

24
Q

central control interface/feature to manage, control, provision stacks across accounts

A

StackSets

25
Q

Only required section of a template in CF

A

resources

26
Q

Two ways to configure instances via CF

A
  1. AWS::CloudFormation::Init template section with cfn-init helper script.
  2. userData property
27
Q

Long running custom resources should use ____

A

SNS Topics. Not lambda b/c lambda has 5 minute timeout.

28
Q

If a stack update includes a bucket name change, what must you do?

A

Create a new bucket

29
Q

User ____ in CF is there to detect a potential for data loss.

A

Change sets

30
Q

Transforms pull template snippets from S3 to update _____

A

The template itself

31
Q

How to implement custom resources in CF (AWS services not compatible with CD)

A

via Lambda or SNS with service token

32
Q

what must occur before a stack that exports an output can be deleted?

A

Any stacks importing the exported value must remove the import.

33
Q

When you attempt to update an Amazon Relational Database Service (Amazon RDS) instance in your AWS CloudFormation stack, you experience a Resource failed to stabilize error, which causes the stack to roll back any changes you attempted. What might be the cause of this error, and how could it be resolved?

A

The database took too long to update, and the session credentials used by AWS CloudFormation timed out. Use a service role to perform the update.

An AWS CloudFormation service role extends the default timeout value for stack actions to allow you to manage resources with longer update periods.

34
Q

Which of these helper scripts performs updates to OS configuration when an AWS CloudFormation stack updates?

A

cfn-hup

35
Q

Which of these options allows you to specify a required number of signals to mark the resource as CREATE_COMPLETE?

A

CreationPolicy

36
Q

How would you access a property of a resource created in a nested stack?

A

In the child stack, declare the resource property as a stack output. In the parent stack, use Fn::GetAtt and pass in two parameters, the child stack logical ID and Outputs.NestedStackOutputName.

37
Q

An AWS CloudFormation template declares two resources: an AWS Lambda function and an Amazon DynamoDB table. The function code is declared inline as part of the template and references the table. In what order will AWS CloudFormation provision the two resources?

A

This cannot be determined ahead of time

38
Q

What does a service token represent in a custom resource declaration?

A

The Amazon Simple Notification Service (Amazon SNS) or AWS Lambda resource Amazon Resource Name (ARN) that receives the request

39
Q

The _______ helper script performs updates on an instance when its parent stack is updated.

A

cfn-hup

40
Q

_______ enable you to specify a count and timeout.

A

creation policies

41
Q

The _______ helper script is used to define which packages, files, and other configurations will be performed when an instance is first launched.

A

cfn-init

42
Q

The _______ helper script is used to signal back to AWS CloudFormation when a resource creation or update has completed

A

cfn-signal