DevOps Engineering on AWS Certification Infrastructure as Code with AWS CloudFormation 1 — Questions and Answers
Question 1: What is the purpose of the CloudFormation `DependsOn` attribute?
- To specify that one resource must be created before another (Correct answer)
- To import values from other stacks
- To enable rollback on failure
- To define stack output values
Correct answer: To specify that one resource must be created before another
The DependsOn attribute ensures that a specific resource is created, updated, or deleted only after another resource, controlling creation order.
Question 2: Which CloudFormation section is used to pass custom values into a template at stack creation time?
- Parameters (Correct answer)
- Mappings
- Conditions
- Outputs
Correct answer: Parameters
The Parameters section allows users to input custom values when creating or updating a stack, making templates reusable across environments.
Question 3: What does `cfn-signal` do in a CloudFormation deployment?
- Signals CloudFormation that a resource has been successfully configured (Correct answer)
- Triggers a CloudFormation stack update
- Deletes a stack on completion
- Exports stack outputs
Correct answer: Signals CloudFormation that a resource has been successfully configured
cfn-signal is a helper script that signals CloudFormation whether a resource, like an EC2 instance, has been successfully created and configured.
Question 4: Which CloudFormation feature allows you to reuse template snippets across multiple templates?
- Nested Stacks (Correct answer)
- StackSets
- Change Sets
- Drift Detection
Correct answer: Nested Stacks
Nested Stacks allow you to embed one CloudFormation stack inside another, enabling reuse of common template patterns and resource definitions.
Question 5: What is a CloudFormation Change Set?
- A preview of the changes CloudFormation will make before executing them (Correct answer)
- A set of parameters passed to a stack
- A rollback plan for failed deployments
- A list of deleted resources
Correct answer: A preview of the changes CloudFormation will make before executing them
A Change Set provides a summary of the proposed changes to a stack, letting you review the impact before executing an update.
Question 6: Which CloudFormation resource type allows you to run custom provisioning logic using Lambda during stack operations?
- Custom Resource (Correct answer)
- CloudFormation Macro
- StackSet
- CloudFormation Hook
Correct answer: Custom Resource
Custom Resources allow you to invoke Lambda functions or SNS topics to perform custom provisioning steps not natively supported by CloudFormation.
What is the purpose of the CloudFormation `DependsOn` attribute?