Cookies Psst! Do you accept cookies?

We use cookies to enhance and personalise your experience.
Please accept our cookies. Checkout our Cookie Policy for more information.

Building Your First CloudFormation Template: A Simple Guide

This guide will help you create a basic CloudFormation template, even if you've never used one before. We'll keep things simple and focus on the essentials.

cloudfromation icon

What is a CloudFormation Template?

Think of it as a recipe for building things in the cloud. You specify what you want (like a storage bucket), and the template takes care of creating it for you.

Our First Template:

We'll start by creating a template that makes a new storage bucket (like a folder) in S3 (a storage service).

was cloudfromation explaination

Here's the basic structure:

{
    "Resources" : {
        "Name-of-your-bucket" : {
            "Type" : "resource type"
            }
        }
}

Let's fill it in:

Name-of-your-bucket: Let's name it easyonebucket ( you can choose any name).
resource type: For an S3 bucket, it's AWS::S3::Bucket

Here's the completed template:

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

Trying it out:

  1. Save the template: Save the code above as a file named bucket.txt.
  2. Go to CloudFormation: In your AWS console, find the CloudFormation service.
  3. Create a stack: Click "create a stack" and give it a name.
  4. Upload the template: Choose "Upload a template to Amazon S3" and select your bucket.txt file.
  5. Click Next a few times and then Create.

You should see "CREATE IN PROGRESS" and then "CREATE_COMPLETE" when it's done.

Finding your bucket: Go to the S3 service in your AWS console. You should see your new bucket named easyonebucket

Why use CloudFormation?

While making a bucket directly is easy, CloudFormation becomes powerful when you have complex setups.

It Helps you:

Simplify infrastructure management
Quickly replicate your infrastructure
Easily track and control changes

Last Stories

What's your thoughts?

Please Register or Login to your account to be able to submit your comment.