How to provision S3 bucket using Pulumi

Reading Time: 5 minutes

In this article we will witness as how we can provision infrastructure using Pulumi YAML extension.

What is Pulumi ?

Pulumi is an infrastructure as a code tool that enables IT administrator to write infra maps in higher level programming language such as Javascript . Go , Python etc. The tool can be integrated into a CI/CD platform using the CLI which talks to the pulumi engine.

Problem that Pulumi solves.

Well now devops is all about automation.The human being is totally relied upon automation which adds an extra layer of dependency.The tool gives few benefits such as

  • Firstly Pulumi , integrated with CI and CD directly. Secondly there is no need for CLI to perform changes.
  • Moreover the delivery with Pulumi is really fast as it is independent of other tools.

In this paragraph Pulumi follows the yaml which we can use to configure system.Today we will discover as how this pulumi can be used to create a s3 bucket . For this we will use the yaml for configuring and automating.

Steps to follow for creating of S3 bucket using pulumi.

1 – Installing Pulumi

Firstly we will be installing Pulumi . To install it follow the below steps.

Run the below command in your terminal.

curl -fsSL | sh

The output is below

Next to access and work with pulumi we need an account on that. To make an account we will move on the next steps.

2 – Creation of account in pulumi.

After installing the binary , the next step is to create an account. After that we will create an access token in the project .


  • A user should have a github or gitlab account.

To create the account follow the below link :-

Link for account –\

To create the account click on the above link

On the above page click on the above mentioned type as per your requisite.Ill be doing it with github.

3 – Generation of Personal access token

To generate the token login and move towards the setting -> Access token . The output below shows the access token page .

Access token page of pulumi.

To generate the token click on create token and it would ask for a name .Generate the token and next will create a pulumi project.

4 – Pulumi project creation.

To create the project first we need to export few environment variables .The environment variable will contain the aws keys etc and access token of pulumi.

export AWS_ACCESS_KEY_ID=    xxxxxxxxxxxxxxxxxxxxxx
export AWS_SECRET_ACCESS_KEY=  xxxxxxxxxxxxxxxxxxx
export PULUMI_ACCESS_TOKEN=  xxxxxxxxxxxxxxxxxxxxxx
export AWS_REGION=  ap-south-1

NOTEThe Pulumi experimental is true that is required to enable additional features like plan and apply .

So for the configuration it needs yaml . For that we need to install yaml plugin. In this most of the explicit resources needs to be installed as a plugin. To install these plugin there is a simple command mentioned below.

pulumi plugin install language yaml

Like the above to install any resource just run the below command:-

pulumi plugin install resource aws

The above shows the installation output of the resource and language.

Initializing the project now .

To initialize the project and stack we need to do the following.But before initializing lets know what stack is.

A stack is an isolated, independently configurable instance of a Pulumi program.

To initialize lets run the below command in our terninal.

pulumi new aws-yaml

The above command will initialize a new project and the output will be like below.

Output of new project make

Next command is to select the dev stack.

The below command will help to select the dev stack .Next this will help to up the project as per the infrastructure.

Provisioning Infrastructure – Setting up s3 using the yaml.

After initializing the project and stack , lets move towards the set up of Infra as code using the above tool. To do this we will use the config as yaml. The config file is used to set up the s3 bucket.The below file is a simple yaml configuration. It will have the resource section , bucket name as per now.

A file is generated in the above command while initializing the project.

The below code snippet represents the content of the file.

name: demo1

runtime: yaml

description: a demo project

  # Create an AWS resource (S3 Bucket)


    type: aws:s3:Bucket


  # Export the name of the bucket

  bucketName: ${}

Next to verify the plan run the below command.It will tell about the components that will be up in the infra. This step will be used to preview the planned state .

pulumi preview --save-plan plan.json

Once the above changes is fine , proceed with the infra provisioning. Next we will run the below command to provision the infra.

pulumi up --plan='plan.json' --non-interactive --yes
Creation of infra as per file.

As the above output shows the creation of s3 using the above IAC.

Lastly the above bucket is made by the infra provisioning of yaml configuration in YAML.

How to access log .

To access logs you should use the below command.

pulumi logs -f

Destroy the resources

pulumi destroy -y


So till now we have seen that this tool is popular among the most popular langauge. Firstly it is a great known infra tool. Iac is nowdays a growing tool that doesn’t enforce enforce a proprietary language.

You can leverage the power of Pulumi across multiple cloud providers by writing configuration files in languages that you are already using to run your apps.


To learn more follow the below link –

Written by 

Rishivant is a enthusiastic devops learner at Knoldus. He believes in going 1% up everyday and showcases his learning in his work.