0
0
AWScloud~30 mins

Creating stacks in AWS - Try It Yourself

Choose your learning style9 modes available
Creating stacks
📖 Scenario: You are working as a cloud engineer for a small company. Your team wants to automate the creation of cloud resources using AWS CloudFormation stacks. You will create a simple CloudFormation stack that provisions an Amazon S3 bucket.
🎯 Goal: Build a CloudFormation stack template step-by-step that creates an Amazon S3 bucket with a specific name.
📋 What You'll Learn
Create a CloudFormation template dictionary with the required keys
Add a Parameters section to specify the bucket name
Add a Resources section to create an S3 bucket using the parameter
Add Outputs section to export the bucket name
💡 Why This Matters
🌍 Real World
CloudFormation templates automate cloud resource creation, saving time and reducing errors.
💼 Career
Cloud engineers and DevOps professionals use CloudFormation to manage infrastructure as code.
Progress0 / 4 steps
1
Create the initial CloudFormation template dictionary
Create a dictionary called template with the key AWSTemplateFormatVersion set to '2010-09-09' and an empty Resources dictionary.
AWS
Need a hint?

Start by defining a Python dictionary with the required keys for a CloudFormation template.

2
Add Parameters section for bucket name
Add a Parameters key to the template dictionary. Inside it, create a parameter called BucketName with Type set to String and Description set to 'Name of the S3 bucket'.
AWS
Need a hint?

Parameters allow users to input values when creating the stack. Add the BucketName parameter inside the Parameters dictionary.

3
Add S3 bucket resource using the parameter
Add a resource called MyS3Bucket inside the Resources dictionary of template. Set its Type to AWS::S3::Bucket and its Properties to use the BucketName parameter with { 'Ref': 'BucketName' }.
AWS
Need a hint?

Resources define the AWS services to create. Use the Ref function to refer to the parameter value.

4
Add Outputs section to export the bucket name
Add an Outputs key to the template dictionary. Inside it, create an output called BucketNameOutput with Description set to 'The name of the S3 bucket' and Value set to { 'Ref': 'MyS3Bucket' }.
AWS
Need a hint?

Outputs allow you to see important information after stack creation. Use Ref to get the resource's name.