Pulumi get start tutorial

Kingyinma
1 min readJun 24, 2021

Offical website, https://www.pulumi.com/

Installation

brew install pulumi

Sign up a new account in pulumi website since you need a Access Token

Then go to https://app.pulumi.com/socloud/settings/tokens, create new token

Back to terminal, login your pulumi account

pulumi login

You can see which account your logged in by using

pulumi whoami

Start new project, …

mkdir {your_new_project_folder}
cd {your_new_project_folder}
pulumi new

Below is a simple example for createing an s3 bucket

add modules/index.ts

Add dotenv package

yarn add dotenv

and place BUCKET_NAME key which is the name of the bucket name you want

BUCKET_NAME=cdn.example-1234.com

Add an index.ts in root

Run command, then it will follow your aws default profile to execute

pulumi up

To destroy the Infrastructure, you can just run

pulumi destory

if you want to setup script base on your profile, you can add more script in your package.json, below are example (replace {your_profile_name})

then you can just run

yarn up
yarn up:abc
yarn destory
yarn destory:abc

Here is link of the example, enjoy !

--

--