A stack update is the process of changing the resources or settings in an existing CloudFormation stack to match a new template or parameters.
Click to reveal answer
beginner
What happens if a stack update fails?
If a stack update fails, CloudFormation rolls back the changes to keep the stack in its previous stable state.
Click to reveal answer
beginner
How do you delete a CloudFormation stack?
You delete a stack by telling CloudFormation to remove all the resources it created for that stack, cleaning up everything automatically.
Click to reveal answer
intermediate
What should you check before deleting a stack?
Check if any resources are still in use or have dependencies outside the stack to avoid breaking other systems.
Click to reveal answer
intermediate
Can you update a stack to remove resources?
Yes, by modifying the template to remove resources and then updating the stack, CloudFormation deletes those resources during the update.
Click to reveal answer
What does CloudFormation do if a stack update fails?
ARolls back to the previous stack state
BLeaves the stack partially updated
CDeletes the stack automatically
DIgnores the failure and continues
✗ Incorrect
CloudFormation rolls back the stack to its previous stable state to avoid partial updates.
Which action deletes all resources created by a CloudFormation stack?
APausing the stack
BUpdating the stack
CCreating a new stack
DDeleting the stack
✗ Incorrect
Deleting the stack removes all resources created by that stack.
How can you remove a resource from a stack?
AUpdate the stack with a template that excludes the resource
BDelete the resource manually
CPause the stack
DRename the resource
✗ Incorrect
Updating the stack with a new template that removes the resource causes CloudFormation to delete it.
Before deleting a stack, what should you verify?
AThat the stack is paused
BThat no resources are used elsewhere
CThat the stack is updated
DThat the stack has no outputs
✗ Incorrect
Ensure no resources are in use outside the stack to prevent breaking dependencies.
What is the main benefit of stack updates?
ACreating new resources only
BDeleting the stack automatically
CChanging existing resources without deleting the stack
DBacking up stack data
✗ Incorrect
Stack updates allow changing resources without deleting the entire stack.
Explain the process and safety mechanisms involved when updating a CloudFormation stack.
Think about how CloudFormation keeps your resources safe during changes.
You got /4 concepts.
Describe the steps and considerations before deleting a CloudFormation stack.
Deleting a stack is like cleaning up a project; make sure nothing important is still connected.
You got /4 concepts.
Practice
(1/5)
1. What is the primary purpose of the update-stack command in AWS CloudFormation?
easy
A. To create a new stack from a template
B. To safely change existing cloud resources managed by a stack
C. To delete all resources created by a stack
D. To list all stacks in your AWS account
Solution
Step 1: Understand the role of update-stack
The update-stack command is used to modify resources that are already managed by an existing CloudFormation stack.
Step 2: Differentiate from other commands
Unlike delete-stack which removes resources, update-stack changes them safely without deleting the stack.
Final Answer:
To safely change existing cloud resources managed by a stack -> Option B
Quick Check:
update-stack = change resources safely [OK]
Hint: Update-stack changes resources; delete-stack removes them [OK]
Common Mistakes:
Confusing update-stack with delete-stack
Thinking update-stack creates new stacks
Assuming update-stack lists stacks
2. Which AWS CLI command syntax correctly deletes a stack named MyAppStack?
easy
A. aws cloudformation delete-stack --stack-name MyAppStack
B. aws cloudformation update-stack --stack-name MyAppStack
C. aws cloudformation remove-stack --name MyAppStack
D. aws cloudformation destroy-stack --stack MyAppStack
Solution
Step 1: Identify the correct delete command
The correct AWS CLI command to delete a stack is delete-stack with the parameter --stack-name.
Step 2: Verify syntax correctness
aws cloudformation delete-stack --stack-name MyAppStack uses the exact syntax: aws cloudformation delete-stack --stack-name MyAppStack, which is valid and deployable.
Final Answer:
aws cloudformation delete-stack --stack-name MyAppStack -> Option A
Quick Check:
delete-stack + --stack-name = correct syntax [OK]
Hint: Delete stacks with 'delete-stack' and '--stack-name' [OK]
Common Mistakes:
Using update-stack instead of delete-stack
Wrong parameter names like --name or --stack
Using non-existent commands like remove-stack or destroy-stack
What is the expected behavior after running these commands?
medium
A. The stack TestStack is updated with the new template, and its status is shown
B. The stack TestStack is deleted, and no status is returned
C. A new stack named TestStack is created, and its details are displayed
D. The command fails because update-stack cannot be followed by describe-stacks
Solution
Step 1: Understand update-stack effect
The update-stack command modifies the existing stack named TestStack using the provided template.
Step 2: Describe-stacks shows current stack status
The describe-stacks command retrieves details about TestStack, including its updated status.
Final Answer:
The stack TestStack is updated with the new template, and its status is shown -> Option A
Quick Check:
update-stack changes stack + describe-stacks shows status [OK]
Hint: Update then describe shows updated stack status [OK]
Common Mistakes:
Thinking update-stack deletes the stack
Assuming describe-stacks creates a new stack
Believing update-stack and describe-stacks cannot be used sequentially
4. You run aws cloudformation update-stack --stack-name ProdStack --template-body file://newtemplate.json but get an error saying the stack is in UPDATE_IN_PROGRESS state. What should you do to fix this?
medium
A. Ignore the error and rerun update-stack multiple times
B. Run delete-stack immediately to remove the stack
C. Change the stack name and try update-stack again
D. Wait for the current update to finish before running update-stack again
Solution
Step 1: Understand stack states during update
When a stack is in UPDATE_IN_PROGRESS, it means an update is already running and must complete before another update starts.
Step 2: Choose the correct action
Waiting for the current update to finish avoids conflicts and errors. Deleting or renaming the stack is unnecessary and may cause data loss or confusion.
Final Answer:
Wait for the current update to finish before running update-stack again -> Option D
Quick Check:
UPDATE_IN_PROGRESS means wait before next update [OK]
Hint: Wait for update to finish before next update [OK]
Common Mistakes:
Trying to delete stack during update
Renaming stack instead of waiting
Ignoring error and retrying immediately
5. You want to update a stack but also ensure that if the update fails, the stack rolls back to its previous state automatically. Which AWS CloudFormation option should you avoid using with update-stack to achieve this?
hard
A. --rollback-configuration
B. --no-rollback
C. --disable-rollback
D. --enable-rollback
Solution
Step 1: Understand rollback behavior in update-stack
By default, CloudFormation rolls back stack updates on failure. The --disable-rollback option disables this behavior.
Step 2: Identify the correct option to keep rollback enabled
To ensure rollback happens automatically on failure, you should NOT disable rollback. Therefore, do not use --disable-rollback. The default behavior is rollback enabled, so omit this option or explicitly avoid disabling rollback.
Step 3: Analyze options
--rollback-configuration is for configuring alarms, --enable-rollback and --no-rollback are not valid AWS CLI options.
Final Answer:
--disable-rollback disables rollback; omit it to keep rollback enabled -> Option C
Quick Check:
Omit --disable-rollback to keep rollback on failure [OK]
Hint: Do not use --disable-rollback to keep rollback active [OK]
Common Mistakes:
Using non-existent --enable-rollback option
Confusing disable-rollback disables rollback
Assuming rollback is off by default
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.