← Back to cheat sheets

Infrastructure as Code

Pulumi cheat sheet

Pulumi manages infrastructure with general-purpose languages.

On this page

Table of contents

Use this page for fast recall. Use Full documentation when you want the complete end-to-end path.

Quick workflow

A simple 5-step flow you can follow when using Pulumi in real work.

1) Setup

Install/run the tool and confirm version. Create a minimal config.

2) Small change

Do one small action end-to-end to prove the workflow.

3) Validate

Check output, logs, and status. Catch mistakes early.

4) Automate

Convert it into a repeatable script or pipeline step.

5) Productionize

Add safety: secrets, rollback, observability, and docs.

Workflows you will actually reuse

These are practical sequences you can copy into your own checklist or runbook.

Preview, deploy, verify

Goal: Make infrastructure changes with a repeatable preview-first habit.

- Set config and secrets per stack.

- Run `pulumi preview` and review diffs.

- Run `pulumi up`.

- Verify outputs and cloud resources.

- Commit with notes and keep stacks isolated.

Key Concepts

- Stacks

- Providers

- Components

Learning path (high-level):

- Stack setup

- Reusable components

- Policy controls

Quick Start

Create project

Command

pulumi new

Preview changes

Command

pulumi preview

Deploy

Command

pulumi up

Common Commands

Short descriptions and practical intent. Search, filter, copy, and reuse.

Showing 13

Basics
pulumi version

Show Pulumi version.

Workflow
pulumi new

Create a new project from template.

Stacks
pulumi stack ls

List available stacks.

Stacks
pulumi stack init dev

Create a new stack.

Stacks
pulumi stack select dev

Switch to a specific stack.

Config
pulumi config set key value

Set stack configuration.

Config
pulumi config set --secret password value

Store secrets securely.

Workflow
pulumi preview

Preview changes (like Terraform plan).

Workflow
pulumi up

Deploy changes.

State
pulumi refresh

Sync state with live resources.

State
pulumi stack output

Show stack outputs.

Workflow
pulumi destroy

Destroy all stack resources.

Debug
pulumi logs --follow

Stream stack operation logs.

Copyable snippets

Small blocks you can drop into your terminal, config, or runbook.

Preview then deploy

bash

pulumi stack select dev
pulumi preview
pulumi up

Troubleshooting checklist

When things break, follow this order to stay calm and move fast.

- If preview differs unexpectedly: check config/stack selection and provider credentials.

- If secrets leak: use `pulumi config set --secret` and rotate credentials immediately.

Pitfalls

The common mistakes that slow people down when using Pulumi.

- Copy-pasting commands without understanding inputs/outputs and side effects.

- Not documenting defaults (ports, paths, credentials) and then getting stuck in prod.

- Skipping logs and metrics when troubleshooting; always collect evidence first.

Mini lab (practice)

Do these tasks in order. You will feel the tool instead of just reading about it.

- Install or run the tool locally (or in Docker) and verify it works with a hello-world action.

- Create a minimal config and run the most common command 3 times (with a small change each time).

- Break something on purpose and document how you debugged it in your Notes.

Interview prompts

Use these to test if you truly understand the basics (and can explain them clearly).

- Explain the tool’s role in a real CI/CD pipeline from commit to production.

- Describe the most common failure you’ve seen with this tool and how you fixed it.

- What would you monitor/alert on for this tool in production?

Official Docs

https://www.pulumi.com/docs/