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
Like this:
Like Loading...