0
0
AWScloud~30 mins

Updating and deleting stacks in AWS - Mini Project: Build & Apply

Choose your learning style9 modes available
Updating and Deleting AWS CloudFormation Stacks
📖 Scenario: You are managing cloud resources using AWS CloudFormation. You need to update an existing stack to change its configuration and then delete it when it is no longer needed.
🎯 Goal: Learn how to update an AWS CloudFormation stack by modifying its template and then delete the stack safely.
📋 What You'll Learn
Create an initial CloudFormation stack with a simple resource
Add a configuration parameter to the stack
Update the stack to change the resource configuration
Delete the stack cleanly
💡 Why This Matters
🌍 Real World
CloudFormation stacks are used to manage and automate cloud resources in AWS. Updating and deleting stacks is a common task when managing infrastructure as code.
💼 Career
Knowing how to update and delete CloudFormation stacks is essential for cloud engineers and DevOps professionals to maintain and evolve cloud infrastructure safely.
Progress0 / 4 steps
1
Create an initial CloudFormation stack
Create a CloudFormation template string variable called template_body with a simple AWS S3 bucket resource named MyBucket. Then create a stack named MyTestStack using the AWS CLI command aws cloudformation create-stack with the --stack-name MyTestStack and --template-body parameters using the template_body variable.
AWS
Need a hint?

Define the template as a JSON string with one S3 bucket resource. Use the AWS CLI command to create the stack with the given name and template.

2
Add a configuration parameter to the stack template
Add a parameter named BucketName of type String to the template_body variable. Modify the MyBucket resource to use this parameter as its BucketName property.
AWS
Need a hint?

Add a Parameters section with BucketName as a string. Reference this parameter in the bucket's BucketName property.

3
Update the stack with a new bucket name
Use the AWS CLI command aws cloudformation update-stack to update the stack named MyTestStack with the modified template_body. Pass the parameter BucketName with the value my-updated-bucket using the --parameters option.
AWS
Need a hint?

Use the update-stack command with the same stack name and template file. Pass the new BucketName parameter value.

4
Delete the CloudFormation stack
Use the AWS CLI command aws cloudformation delete-stack to delete the stack named MyTestStack.
AWS
Need a hint?

Use the delete-stack command with the stack name to remove the stack and its resources.