CloudFormation 2 Flashcards

1
Q

Deletion Policy

What is CFN DeletionPolicy?

A

Attribute on a Resource. When true, deleting the stack will leave the resource intact.

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

Deletion Policy

What are the three values for DeletionPolicy?

A

Delete, Retain, Snapshot (takes a snapshot of a DB, then deletes it)

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

Deletion Policy

If you mark a Resource with “Retain” on deletion, can it be deleted?

A

YES, if a change requires delete-then-create, or if you just want to delete it youself.

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

Stack Roles, Change Sets

Normally need permission to create everything. That’s a lot. How deal with this?

A

Create a Stack Role: Role with permissions to do everything. Use PASS ROLE to use it.

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

Stack Roles, Change Sets

What’s PassRole?

A

You have permission to give the roll to something (CFN), but not to assume it yourself.

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

Stack Roles, Change Sets

About to deploy a tmpl, but worried it might delete-then-create a RDS database.

A

ChangeSet: see what it would do, let it proceed or stop it.

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

Stack Roles, Change Sets

How can you prevent changes to a Stack from altering certain high-value resources?

A

Use a CloudFormation Stack Policy and deny updates explicitly.

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

Wait and Signal

What is the typical use case for Wait+Signal?

A

Provision an EC2, have CFN wait around until EC2 up and ready and tells CFN that it’s done

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

Wait and Signal

How do you configure wait+Signal?

A

Pick number of success messages needed to continue, and a timeout

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

Wait and Signal

What is the actual service on an EC2 instance that can tell a CFN stack to continue?

A

cfn-signal

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

Wait and Signal

What can cfn-signal communicate back to the stack?

A

Success or Failed

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

Wait and Signal

What do you put in a CFN template to say it should wait for a signal?

A

CreationPolicy if EC2 or ASG, WaitCondition otherwise

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

Wait and Signal

Why both a CreationPolicy and a WaitCondition exist?

A

CreationPolicy built into the CFN schema for EC2 and ASG

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

Wait and Signal

How do you use a WaitCondition?

A

Issues a pre-signed URL. Anything using this PSU can tell CFN to continue

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

Wait and Signal

What are Signals?

A

Set per-resource in CFN stack. Call to the AWS SDK when the CFN stack is waiting. When the Signal is called, CFN unblocks.

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

Wait and Signal

Typical use of Signals?

A

Set Signal on EC2 Instance. When init code inside instance is ready, signal CFN.

17
Q

Wait and Signal

What is CFN doing while a Signal hasn’t arrived yet?

A

The single Resource doesn’t go to CREATE_COMPLETE until the Signal arrives.

18
Q

Wait and Signal

Technical details of how a Signal is sent?

A

Uses a pre-signed URL where you store the status.

19
Q

Wait and Signal

What specific setting to have an EC2 wait for a signal when EC2 created?

A

“CreatePolicy” with number of signals

20
Q

Wait and Signal

Make a Create ASG CFN wait until has some available instances?

A

MinSuccessfulInstancesPercent under CreatePolicy

21
Q

Wait and Signal

How get CFN Stack to wait until a signal (non-EC2 stuff)?

A

Create AWS::CloudFormation::WaitCondition. Use DependsOn to stop other things from creating.

22
Q

Custom Resources

What things will CFN call to implement a Custom Resource?

A

SNS or Lambda function

23
Q

Custom Resources

What’s the flow for custom resources?

A

CFN calls SNS/Lambda, passes in lots of data including pre-signed URL. Write JSON status to PSU.