Module 8: CloudFormation Assignment - 1

Training Problem Statement: You work for XYZ Corporation. Your team is asked to deploy similar architecture multiple times for testing, development, and production purposes. Implement CloudFormation for the tasks assigned to you below.

Tasks To Be Performed:

  1. Create a template which can create an S3 bucket named “Intellipaat-”
  2. The template should be able to enable versioning for the bucket created.
  1. Crafting the CloudFormation Template: I fired up my trusted text editor and initiated a new document. I named this file s3_bucket_template.yaml.

At the very beginning of my file, I penned down the following to define the template’s version and its purpose:

AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template to create an S3 bucket with versioning enabled.
  1. Laying Out the Resource Details: Diving into the core part, I began with the Resources section to define my S3 bucket:
Resources:
  MyS3Bucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: intellipaat-hector
      VersioningConfiguration:
        Status: Enabled
  1. Saving and Deploying My Work:
  • Once satisfied with the configurations, I saved the s3_bucket_template.yaml file.
  • Navigating back to the CloudFormation section in the AWS console, I clicked on “Create Stack”.
  • I then uploaded the s3_bucket_template.yaml and closely followed the on-screen instructions.

s3_bucket_template.yaml

AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template to create an S3 bucket with versioning enabled.
 
Resources:
  MyS3Bucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: intellipaat-hector
      VersioningConfiguration:
        Status: Enabled


  1. Validating My Implementation:

Success

As expected, I found my freshly minted bucket, “intellipaat-hector”, and confirmed that versioning was indeed enabled.