AWS Classroom Series – 11/Feb/2020

Exercise-1 : Create S3 bucket using CF Template

  • Lets start with minimal template
{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Exercise-1: Create S3 bucket",
    "Resources": {
        
    }
}
  • Now we need to create s3 bucket which is a resource.
  • In cf to create a resource there is a special syntax
 "resourceName": {
            "Description": "-",
            "Type": "-",
            "Properties": "-"
        }
  • resourceName is the name given for the usage with in cloud formation.
"qtstorage" : {
    Description
    ...
    ...
}

"qtstorage" will not be name of your resource in aws i.e. qtstorage will not be s3 bucket name
  • To get aws s3 resource definition navigate to google search and type aws cloudformation s3 or search for the service/resource type in here
  • We had written the following sample template
{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Exercise-1: Create S3 bucket",
    "Resources": {
        "mys3bucket": {
            "Type" : "AWS::S3::Bucket",
            "Properties": {
                "BucketName": "qts3fromcfdemo"
            }
        }

    }
}
  • Stack: Template when executed to create resources. Stack will create all the resources on success and none on failure
  • Deleting the stack is deleting all the resources created by using template.

Exercise-2 Create an S3 bucket with some name and then change the name of the bucket

  • Create an Stack with the following template
{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "Exercise-1: Create S3 bucket",
    "Resources": {
        
        "myqtstorage": {
            "Type": "AWS::S3::Bucket",
            "Properties": {
                "AccessControl": "PublicRead",
                "BucketName": "qts3fromclidemo"
            }
        }
    }
}
  • Now change the name of the bucket from qts3fromclidemo to qts3fromclidemo1. Before we change this we need to understand the Replacement.
    • Navigate to here.
    • Go to the BucketName and look at Update Requires section. If the Update Requires has a value of
      • Replacement: resource will be deleted and recreated with new property
      • No Interruption: the property will be updating without deleting

Exercise 3: Write a CF template to create s3 bucket and vpc with cidr range of 192.168.0.0/16

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%