Pulumi — Modern Infrastructure as Code
Provision any cloud infrastructure using TypeScript, Python, Go, C#, or Java. Pulumi brings real programming languages, package managers, and IDE tooling to infrastructure.
What is Pulumi?
Pulumi is an open-source infrastructure-as-code platform founded in 2017 that fundamentally rethinks how developers define cloud resources. Rather than inventing a new configuration language, Pulumi lets you write infrastructure code using TypeScript, Python, Go, C#, or Java — the same languages you already use for your applications. This means real loops, functions, classes, conditionals, package managers (npm, pip, go mod), unit tests, and all the IDE tooling you depend on daily.
Pulumi supports over 100 cloud providers through a rich provider ecosystem including AWS, Azure, Google Cloud, Kubernetes, Cloudflare, MongoDB Atlas, GitHub, and many SaaS platforms. A single Pulumi program can provision resources across multiple providers, making it uniquely suited for organizations running workloads across clouds or managing cloud infrastructure alongside SaaS configuration.
Key Features
- General-purpose languages — TypeScript, Python, Go, C#, Java with full IDE support
- Multi-cloud — one platform for AWS, Azure, GCP, Kubernetes, and 100+ providers
- State management — Pulumi Cloud (managed), S3, Azure Blob, GCS, or local backends
- Stack config & secrets — per-environment config with encrypted secret values
- Automation API — embed Pulumi engine in your applications for programmatic deployments
- CrossGuard Policy as Code — enforce organizational policies automatically during deployments
- StackReference — compose stacks together and share outputs across environments
- pulumi preview — dry-run that shows exactly what will change before deploying
Getting Started: TypeScript Program
Install the Pulumi CLI and create a new project:
curl -fsSL https://get.pulumi.com | sh pulumi new aws-typescript npm install
Define an S3 bucket, Lambda function, and API Gateway:
// index.ts
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const environment = config.require("environment");
// S3 bucket for file storage
const bucket = new aws.s3.Bucket("data-bucket", {
acl: "private",
versioning: { enabled: true },
serverSideEncryptionConfiguration: {
rule: {
applyServerSideEncryptionByDefault: {
sseAlgorithm: "AES256",
},
},
},
tags: { Environment: environment, ManagedBy: "Pulumi" },
});
// IAM role for Lambda
const lambdaRole = new aws.iam.Role("lambda-role", {
assumeRolePolicy: aws.iam.assumeRolePolicyForPrincipal({
Service: "lambda.amazonaws.com",
}),
});
new aws.iam.RolePolicyAttachment("lambda-basic", {
role: lambdaRole.name,
policyArn: aws.iam.ManagedPolicy.AWSLambdaBasicExecutionRole,
});
// Lambda function
const processor = new aws.lambda.Function("processor", {
runtime: aws.lambda.Runtime.NodeJS20dX,
handler: "index.handler",
role: lambdaRole.arn,
code: new pulumi.asset.AssetArchive({
"index.js": new pulumi.asset.StringAsset(
`exports.handler = async (e) => ({ statusCode: 200, body: 'OK' });`
),
}),
environment: {
variables: { BUCKET_NAME: bucket.bucket },
},
});
// Stack outputs — accessible from other stacks via StackReference
export const bucketName = bucket.bucket;
export const bucketArn = bucket.arn;
export const lambdaArn = processor.arn; Manage stacks and deploy:
pulumi stack init dev # create dev stack pulumi config set environment dev # set config value pulumi config set --secret dbPass s3cr3t # encrypted secret pulumi preview # dry-run, see what changes pulumi up # deploy pulumi stack output bucketName # read stack output pulumi destroy # tear down resources
Automation API Example
// deploy-programmatically.ts
import { LocalWorkspace } from "@pulumi/pulumi/automation";
async function provisionTenant(tenantId: string) {
const stack = await LocalWorkspace.createOrSelectStack({
stackName: `tenant-${tenantId}`,
workDir: "./infrastructure",
});
await stack.setConfig("tenantId", { value: tenantId });
await stack.setConfig("dbPassword", { value: "secret", secret: true });
const result = await stack.up({ onOutput: console.log });
console.log(`Tenant ${tenantId} provisioned:`, result.outputs);
return result.outputs;
}
// Call from your SaaS app when a customer signs up
provisionTenant("customer-abc-123"); Pulumi vs Alternatives
| Feature | Pulumi | Terraform | AWS CDK | Crossplane |
|---|---|---|---|---|
| Language | TS / Python / Go / C# / Java | HCL | TS / Python / Java / C# / Go | YAML (Kubernetes CRDs) |
| Cloud scope | Multi-cloud + SaaS (100+) | Multi-cloud (1000+ providers) | AWS only | Multi-cloud via K8s |
| State backend | Pulumi Cloud / S3 / GCS / local | TF Cloud / S3 / local | CloudFormation (managed) | etcd (Kubernetes) |
| Automation API | Yes (first-class) | Limited (CLI wrapping) | No | K8s API |
| Policy as code | CrossGuard (TS/Python) | Sentinel / OPA | CDK Aspects | OPA / Kyverno |
| Community size | Growing | Very large | Large (AWS ecosystem) | Medium (K8s community) |
Use Cases
- Multi-cloud infrastructure managed from a single codebase with shared language and tooling
- SaaS platforms that provision cloud resources per customer using the Automation API
- Teams who want to unit-test infrastructure code with Jest, pytest, or Go testing
- Organizations enforcing security and compliance policies automatically via CrossGuard
- Developers migrating from Terraform who prefer TypeScript or Python over HCL
- Kubernetes users who want to manage cloud resources alongside K8s manifests
Pros and Cons
Pros
- ✓ Real programming languages with full IDE support
- ✓ Multi-cloud and SaaS providers in one tool
- ✓ Automation API enables infrastructure-as-a-feature
- ✓ Unit-testable with standard testing frameworks
- ✓ Encrypted secrets built into config system
- ✓ StackReference for modular stack composition
Cons
- ✗ Smaller community and provider ecosystem than Terraform
- ✗ Pulumi Cloud required for full team features (paid)
- ✗ Language flexibility can lead to inconsistent codebases
- ✗ State file conflicts can be tricky to resolve
- ✗ Longer cold start for complex programs vs HCL plans
- ✗ Less mature than Terraform in enterprise tooling
Frequently Asked Questions
What makes Pulumi different from Terraform?▼
Pulumi uses general-purpose programming languages (TypeScript, Python, Go, C#, Java) instead of a domain-specific language like HCL. This gives you real loops, conditionals, functions, classes, package managers, and IDE support out of the box. Pulumi also uses an explicit resource model with async/await, making it easy to express dependencies. Terraform's HCL is simpler to learn and has a larger community and provider ecosystem, but Pulumi is often more productive for complex infrastructure because you write real code.
How does Pulumi manage state?▼
Pulumi stores state in a backend that tracks which cloud resources belong to your stack. By default it uses the Pulumi Cloud (managed service, free tier available) which provides collaboration, secrets encryption, history, and policy enforcement. You can also use self-managed backends: AWS S3, Azure Blob Storage, Google Cloud Storage, or a local filesystem. Each Pulumi stack (dev/staging/prod) gets its own state file. pulumi stack ls lists stacks, pulumi state export exports state for inspection or repair.
What is a Pulumi Stack and how do environments work?▼
A Pulumi Stack is an isolated instance of your program — think of it as an environment. You can have stacks named dev, staging, and prod, each with different config values and potentially different cloud accounts or regions. Config is set with pulumi config set key value and accessed in code with config.require('key'). Secrets are encrypted: pulumi config set --secret dbPassword mySecret. Stacks can export values (stack outputs) that other stacks can read via StackReference, enabling stack composition.
Does Pulumi support multiple cloud providers?▼
Yes. Pulumi has providers for over 100 cloud platforms and services including AWS, Azure, Google Cloud, Kubernetes, Cloudflare, Datadog, MongoDB Atlas, GitHub, and more. You can use multiple providers in the same program — for example, provision an AWS RDS database, configure a Datadog monitor, and create a GitHub Actions secret all in one Pulumi program. This makes Pulumi particularly powerful for multi-cloud or cloud-plus-SaaS infrastructure.
What is the Pulumi Automation API?▼
The Automation API is a programmatic interface to the Pulumi engine that lets you embed infrastructure management inside your own applications and scripts. Instead of running pulumi up from the CLI, you call pulumi.automation.LocalWorkspace.createOrSelectStack() from TypeScript or Python, set config values, and call stack.up(). This enables use cases like infrastructure-as-a-feature (SaaS apps that provision cloud resources per customer), custom deployment UIs, and CI/CD systems that need fine-grained programmatic control.
What is Pulumi CrossGuard (Policy as Code)?▼
CrossGuard is Pulumi's policy-as-code framework. You write policies in TypeScript or Python that run during pulumi preview and pulumi up to enforce organizational standards — for example, blocking S3 buckets without encryption, requiring resource tags, or preventing public security groups. Policies are packaged into Policy Packs and can be applied to individual stacks or enforced organization-wide via Pulumi Cloud. This replaces ad-hoc review checklists with automated, testable guardrails.
Related Products
on GumroadPremium Workflow Pack
Production-grade workflows, architecture guides, and deployment scripts for teams that ship. 10 advanced CI/CD workflows (blue-green, canary, E2E, security), 5 architecture deep-dives, code review checklist, PR process guide, and 5 battle-tested Bash deployment scripts.
Buy on Gumroad →GitHub Actions CI/CD Templates Pack
12 production-ready GitHub Actions workflow templates covering Node.js, Python, Docker, multi-environment deployments, security scanning, and auto-changelog. Copy, paste, ship.
Buy on Gumroad →Developer Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →You Might Also Need
Pulumi Stack Config Generator
Generate Pulumi stack configuration files and TypeScript/Python code. Build Pulumi.yaml, stack configs, and resource definitions for AWS, Azure, and GCP.
Open free tool →
Infrastructure Cost Calculator
Compare and estimate monthly infrastructure costs for AWS EC2, Azure VMs, and Google Compute Engine. Add storage and data transfer for total monthly cloud cost.
Open free tool →
Age Calculator
Calculate exact age in years, months, and days from a birthdate. Shows total days/weeks lived, next birthday countdown, day of week born, Chinese zodiac, and Western zodiac sign.
Open free tool →
More Free Tools
Related Articles
Terraform vs Pulumi 2026: Infrastructure as Code Comparison with Code Examples
Complete Terraform vs Pulumi comparison for 2026 — syntax, state management, multi-cloud support, testing, pricing, and when to choose each IaC tool.
AWS CDK vs Terraform vs Pulumi: Infrastructure as Code Comparison 2026
Complete comparison of AWS CDK, Terraform, and Pulumi for infrastructure as code in 2026 — language support, state management, multi-cloud, community, and when to use each.
Pulumi vs Terraform 2026: Which IaC Tool Should You Choose?
A deep comparison of Pulumi and Terraform for infrastructure as code in 2026. Covers syntax, state management, provider ecosystem, team adoption, and when to choose each tool.
Terraform vs Pulumi vs AWS CDK: Infrastructure as Code Comparison 2026
Complete comparison of Terraform, Pulumi, and AWS CDK for infrastructure as code in 2026. Covers language support, state management, learning curve, ecosystem, cloud support, pricing, and when to use each tool.
Terraform vs Pulumi: Infrastructure as Code Comparison 2026
In-depth comparison of Terraform and Pulumi for Infrastructure as Code in 2026. Covers HCL vs real programming languages, state management, provider ecosystem, and when to use each.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →