This is a complete, hands-on Pulumi cheat sheet: install, configure, operate, automate and secure it - with copy-paste commands grouped by task. Bookmark it for day-to-day work, incidents and interviews alike.
Pulumi lets you define cloud infrastructure using general-purpose languages (TypeScript, Python, Go, C#), bringing loops, functions, tests and IDE support to IaC while keeping a Terraform-like plan/apply model.
Why you reach for it
- Use real languages with loops, functions and unit tests
- Strong typing and IDE autocomplete for cloud resources
- Reuse existing packages and testing frameworks
Installation
curl -fsSL https://get.pulumi.com | sh
pulumi version
pulumi new aws-typescriptConfiguration reference
An S3 bucket defined in TypeScript.
import * as aws from "@pulumi/aws";
const assets = new aws.s3.BucketV2("assets", {
bucket: "acme-assets",
tags: { Environment: "prod" },
});
export const bucketName = assets.bucket;Core commands you use daily
pulumi preview
pulumi up
pulumi stack output bucketNameStacks & deploy
pulumi new aws-typescript
pulumi stack init acme/prod
pulumi preview
pulumi up --yes
pulumi destroy
pulumi stack output bucketNameConfig & secrets
pulumi config set aws:region eu-west-1
pulumi config set --secret dbPassword s3cr3t
pulumi stack select acme/stagingUse it in CI/CD
Preview and deploy with the Pulumi GitHub Action.
- uses: pulumi/actions@v6
with: { command: up, stack-name: acme/prod }
env: { PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} }Best-practice checklist
- Keep programs declarative; push logic into tested helpers
- Use pulumi config set --secret for encrypted config
- Write unit tests with the language's normal test tools
Common pitfalls to avoid
- Putting imperative logic with side effects in resource code
- Leaking secrets into stack config without encryption
- No unit tests despite using a real language
Security quick wins
- Encrypt secrets in state and config
- Use least-privilege cloud credentials in CI
Works well with
- Terraform - Declarative, provider-agnostic infrastructure as code with a planned, reviewable change workflow.
- OpenTofu - The open-source, community-governed fork of Terraform - same HCL, MPL-licensed.
- Amazon Web Services - The largest public cloud - compute, storage, networking and managed services, best driven by IaC.
A cheat sheet is muscle memory on paper - keep it close until the commands live in your fingers.
Want senior help putting Pulumi to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.