Creating and updating a CloudFormation stack
I’m sure you’ve done this before.
We begin by developing our template first. This is going to be a simple S3 bucket. I’m going to use YAML template formatting, but you may use JSON formatting if you wish:
// my_bucket.yamlAWSTemplateFormatVersion: "2010-09-09" Description: This is my first bucket Resources: MyBucket: Type: AWS::S3::Bucket
Now, we just need to create the stack with awscli
:
$ aws cloudformation create-stack \ --stack-name mybucket \ --template-body file://my_bucket.yaml
After a while, we will see that our bucket has been created if we go to the AWS console or run aws s3 ls
in the terminal.
Now, let’s add some public access to our bucket:
// my_bucket.yamlAWSTemplateFormatVersion: "2010-09-09" Description: This is my first bucket Resources: ...