0% found this document useful (0 votes)
2 views5 pages

Getting Started With CloudFormation

This document provides a hands-on lab guide for using AWS CloudFormation to create and update S3 buckets. It outlines the steps to log in to AWS, create a CloudFormation stack, and update it to add and rename S3 buckets using JSON templates. By the end of the lab, users will be familiar with CloudFormation and able to experiment with their own templates.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Getting Started With CloudFormation

This document provides a hands-on lab guide for using AWS CloudFormation to create and update S3 buckets. It outlines the steps to log in to AWS, create a CloudFormation stack, and update it to add and rename S3 buckets using JSON templates. By the end of the lab, users will be familiar with CloudFormation and able to experiment with their own templates.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Getting Started with CloudFormation

Introduction
CloudFormation is a powerful automation service within AWS. It can be used to
create simple or complex sets of infrastructure any number of times. This hands-on
lab provides a gentle introduction to CloudFormation, using it to create and update
a number of S3 buckets. By the end of this hands-on lab, you will be comfortable
using CloudFormation and can begin experimenting with your own templates.
Solution
 Log in to the live AWS environment using the credentials provided, and make
sure you are in the us-east-1 (N. Virginia) Region.
 The CloudFormation templates and other hands-on lab files can be found on
GitHub. Click Code, and select Download ZIP.
 Open the ZIP file and navigate to > labs > getting_started_with_cfn.
 Open the following files in your preferred text editor that will not disturb the
formatting of the file (e.g., VS Code): createstack.json, updatestack1.json,
and updatestack2.json.
A list of AWS resources and what happens when updates occur can be found online.
Create a CloudFormation Stack
1. In the AWS console, navigate to CloudFormation.
2. Click Create stack > With new resources (standard).
3. Under Prerequisite - Prepare template, select Build from Application
Composer.
4. Select the Create in Application Composer button that appears below.
5. At the top of the page, select the Template button .
6. Navigate back to your text editor and open the createstack.json file.
7. Copy all the information within the createstack.json file.
8. Navigate back to your CloudFormation browser tab, and in the template pane,
delete the code and paste in the file information you just copied.
9. Click on Create template
10.Click on the Confirm and continue to CloudFormation button on the pop-
up window.
11.In the bottom right corner, click Next.
12.For Stack name, enter cfnlab.
13.Click Next.
14.Scroll through the available stack options, leaving them all at the defaults,
and click Next.
15.Review your selections, and click Submit.
16.Refresh the Events section to watch the progress.
17.Navigate to S3 in a new browser tab. You should see the newly created
cfnlab-catpics bucket.
Update the CloudFormation Stack to Add an S3 Bucket
1. Navigate back to your text editor and open the updatestack1.json file.
2. Copy all the information within the updatestack1.json file.
3. Navigate back to your CloudFormation browser tab, and on the left side under
Stacks, ensure cfnlab is selected.
4. In the upper right corner, click Update.
5. Under Prerequisite - Prepare template, select Edit in Application
Composer.
6. Click Edit in Application Composer.
7. At the top of the page, select the Template button tab and then replace the
current template with the template information you just copied.
8. Up the upper right corner, click Update template.
9. Click Confirm and continue to CloudFormation.
10.Click Next until you get to the Review cfnlab page.
11.Scroll down to the Change set preview section and review the changes that
will be made based on the updatestack1.json template. You should see a new
dogpics resource will be added.
12.Click Submit.
13.Refresh the Events section to watch the progress.
14.Once it's finished updating, click on the refresh button on the left side next to
Stacks. Under cfnlab, you should see the update is complete.
15.Navigate to the S3 browser tab and refresh the page. You should see the new
dogpics bucket.
Update the CloudFormation Stack to Rename the S3 Bucket
1. Open the updatestack2.json file in a text editor.
2. Change or add to the 123 characters in catsareawesome123 to something
unique (e.g., a string of random alphanumeric characters such as
catsareawesome123thisismybucket ).
3. Copy the contents of the file, and navigate back to the CloudFormation
browser tab.
4. On the left side under Stacks, ensure cfnlab is selected.
5. In the upper right corner, click Update.
6. Under Prerequisite - Prepare template, select Edit in Application
Composer.
7. Click Edit in Application Composer.
8. At the top of the page, select the Template button tab and then replace the
current template with the template information you just copied.
9. Up the upper right corner, click Update template.
10.Click Confirm and continue to CloudFormation.
11.Click Next until you get to the Review cfnlab page.
12.Scroll down to the Change set preview section and review the changes.
Under Replacement, you should see True is displayed. This means AWS is
going to create a new S3 bucket and delete the old bucket.
13.You should now see the catsareawesome(with your chosen string) bucket,
and see the catpics bucket was deleted.
Conclusion
Congratulations — you've completed this hands-on lab!

Createstack json file:

{
"Resources": {
"catpics": {
"Type": "AWS::S3::Bucket"
}
}
}

Updatestack1 json file:

{
"Resources": {
"catpics": {
"Type": "AWS::S3::Bucket"
},
"dogpics": {
"Type": "AWS::S3::Bucket"
}
}
}

Update stack 2 json file:

{
"Resources": {
"catpics": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "catsareawesome123"
}
},
"dogpics": {
"Type": "AWS::S3::Bucket"
}
}
}

You might also like