ConfigsApr 11, 2026·1 min read

Pulumi — Infrastructure as Code in Any Programming Language

Pulumi is infrastructure as code using general-purpose languages: TypeScript, Python, Go, C#, Java, YAML. Unlike Terraform HCL, Pulumi lets you use loops, functions, classes, and real package ecosystems to describe cloud infra.

AI
AI Open Source · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

# Install
brew install pulumi                         # macOS
curl -fsSL https://get.pulumi.com | sh

# Login (state backend)
pulumi login                                # Pulumi Cloud
pulumi login --local                        # Local file backend
pulumi login s3://my-bucket                 # S3 backend

# New project
mkdir my-infra && cd my-infra
pulumi new aws-typescript

TypeScript example index.ts:

import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";

const bucket = new aws.s3.Bucket("my-bucket", {
  tags: { Project: "TokRepo" },
});

const bucketObject = new aws.s3.BucketObject("index.html", {
  bucket: bucket.id,
  content: "Hello from Pulumi",
  contentType: "text/html",
});

export const bucketName = bucket.id;
export const websiteUrl = pulumi.interpolate`https://${bucket.websiteEndpoint}`;
pulumi preview                              # Dry-run
pulumi up                                   # Apply
pulumi destroy                              # Tear down
pulumi stack export                         # Backup state
Intro

Pulumi is infrastructure as code using general-purpose programming languages. Unlike Terraform HCL or CloudFormation YAML, Pulumi lets you write infrastructure in TypeScript, Python, Go, C#, Java, or YAML — giving you loops, functions, classes, and the full power of a real programming ecosystem (npm, pip, Maven).

What Pulumi Does

  • Multi-language IaC — TS, Python, Go, C#, Java, YAML
  • Multi-cloud — AWS, Azure, GCP, Kubernetes, 140+ providers
  • State management — Pulumi Cloud (SaaS), self-hosted, S3, Azure Blob, local file
  • Policy as Code — CrossGuard policies in TS/Python
  • Secrets — encrypted state and config
  • Component Resources — package reusable abstractions
  • Automation API — programmatically drive Pulumi
  • Import — bring existing cloud resources under Pulumi
  • ESC — environments, secrets, configuration service

Architecture

Your program is a regular TS/Python/Go app using Pulumi SDK. At runtime it builds a resource graph. Pulumi engine computes a plan against current state and executes changes via provider plugins (which wrap Terraform providers or native cloud SDKs).

Self-Hosting

Pulumi CLI is open source. State backend options include Pulumi Cloud (managed SaaS) or self-hosted backends (S3, Azure Blob, GCS, local file). For enterprise: Pulumi Cloud Self-Hosted.

Key Features

  • Real programming languages
  • 140+ cloud providers
  • Policy as Code (CrossGuard)
  • Component resources for abstraction
  • Secrets encryption
  • Import existing resources
  • Automation API
  • Stack references across projects
  • Easy testing via unit tests
  • Pulumi ESC for environment/secrets management

Comparison

Tool Language State Provider Count
Pulumi TS/Py/Go/C# Managed or self 140+
Terraform HCL tfstate file 3000+
OpenTofu HCL (Terraform fork) tfstate Same as TF
CDK (AWS) TS/Py/Java/C# CloudFormation AWS only
Cdktf TS/Py/Go/C# tfstate TF-compatible
CloudFormation YAML/JSON AWS AWS only

常见问题 FAQ

Q: Pulumi vs Terraform? A: Terraform HCL 是 DSL(上手快,但表达力受限);Pulumi 用真实编程语言(复杂逻辑、循环、类、测试更自然)。Terraform 生态更大、Pulumi 开发体验更好。

Q: 可以用 TS 写 K8s 吗? A: 可以。@pulumi/kubernetes 提供全部 K8s 资源类型,强类型自动补全。比 YAML 宜人。

Q: state 放哪? A: 默认推荐 Pulumi Cloud(免费 tier 够小团队用)。要完全私有则用 S3/Azure Blob/GCS + encryption-provider。

来源与致谢 Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets