Member-only story
Introduction to AWS CloudFormation
Infrastructure as code (IaC) service that helps you model and set up your AWS resources.

AWS CloudFormation is a service that helps you model and set up your AWS resources so that you can spend less time managing those resources and more time focusing on your applications that run in AWS.
Creating your first stack
In your favorite IDE create a YML file as shown below, but you may use JSON formatting if you wish.

Is a good idea to install one of the Cloudformation plug-ins avilable, I’m using Visual Studio Code :-).
bucket.yml
AWSTemplateFormatVersion: "2010-09-09"
Description: This is my first bucket
Resources:
MyBucket:
Type: AWS::S3::Bucket
This simple template will create a bucket, for that purpose we use the awscli.
If you don´t have the awscli installed please refer to this guide.
$ aws cloudformation create-stack \
--stack-name mybucket\
--template-body file://bucket.yml
The --template-body
argument must be specified as a file URI. Code fixed.

After a couple of minutes we can see the resources created, go to the AWS console or run aws s3 ls on your terminal.
Let´s continue. We can add a public access to the bucket, by default the bucket is not public as you can see in the previous image.
buckey.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: This is my first bucket
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
AccessControl: PublicRead
To update we use the command aws cloudformation update-stack (instead of create-stack).
$ aws cloudformation create-stack \
--stack-name…