DevOps Engineering on AWS Certification Infrastructure as Code with AWS CloudFormation 2 — Questions and Answers
Question 1: What does CloudFormation StackSets allow you to do?
- Deploy stacks across multiple AWS accounts and regions simultaneously (Correct answer)
- Version control CloudFormation templates
- Preview changes before deployment
- Detect configuration drift
Correct answer: Deploy stacks across multiple AWS accounts and regions simultaneously
StackSets extend CloudFormation by enabling you to create, update, or delete stacks across multiple accounts and regions with a single operation.
Question 2: Which CloudFormation behavior occurs by default when a stack update fails?
- Automatic rollback to the previous state (Correct answer)
- Stack deletion
- Partial update left in place
- A manual intervention prompt
Correct answer: Automatic rollback to the previous state
By default, CloudFormation automatically rolls back a stack to its last known stable state when an update fails.
Question 3: What is the purpose of the `Fn::ImportValue` intrinsic function in CloudFormation?
- To import an output value exported by another stack (Correct answer)
- To import parameters from SSM Parameter Store
- To load a JSON file into the template
- To reference a resource in the same stack
Correct answer: To import an output value exported by another stack
Fn::ImportValue retrieves the value of an output exported by another CloudFormation stack, enabling cross-stack resource sharing.
Question 4: What does CloudFormation Drift Detection identify?
- Resources whose configuration has diverged from the stack template (Correct answer)
- Stacks that have failed to deploy
- Unused IAM permissions in a stack
- Orphaned resources not in any stack
Correct answer: Resources whose configuration has diverged from the stack template
Drift Detection compares the current configuration of stack resources with the expected configuration defined in the template, flagging any differences.
Question 5: Which CloudFormation section maps keys to values, often used for environment-specific configuration like AMI IDs?
- Mappings (Correct answer)
- Parameters
- Conditions
- Metadata
Correct answer: Mappings
The Mappings section defines static lookup tables keyed by region, environment, or other variables, commonly used to select region-specific AMI IDs.
Question 6: What is the function of `AWS::CloudFormation::WaitCondition`?
- To pause stack creation until a signal is received from an EC2 instance (Correct answer)
- To wait for an S3 bucket to be populated
- To delay stack deletion
- To hold an update until a human approves
Correct answer: To pause stack creation until a signal is received from an EC2 instance
WaitCondition pauses CloudFormation stack creation until it receives a specified number of success signals, typically from EC2 user data scripts.
What does CloudFormation StackSets allow you to do?