Pulumi AWS Infrastructure
TypeScript Pulumi program for S3, Lambda, and API Gateway.
A TypeScript Pulumi program provisioning a serverless backend on AWS. Defines S3 buckets, Lambda functions, API Gateway v2, IAM roles, and CloudWatch alarms using Pulumi's strongly-typed AWS SDK — no YAML, no DSL.
Tech Stack
Features
- S3 bucket with versioning, lifecycle rules, and server-side encryption
- Lambda function with bundled TypeScript handler via esbuild
- API Gateway v2 HTTP API with JWT authoriser
- CloudWatch alarms for Lambda errors and throttles
- Pulumi ESC for secrets — no plaintext in state
Why Pulumi Over Terraform
Using TypeScript means the infrastructure and application share the same language, type system, and package manager. IDE autocomplete and type errors catch misconfigurations at author time rather than at plan/apply time.
State Management
State is stored in Pulumi Cloud. Each stack (`dev`, `staging`, `prod`) has isolated state and can be previewed with `pulumi preview --stack dev` without affecting other environments.
Running Locally
Install the Pulumi CLI and configure AWS credentials. Run `npm install` then `pulumi up --stack dev`. Pulumi will show a diff and prompt for confirmation before provisioning.
File Structure
- index.ts
- Pulumi.yaml
- Pulumi.dev.yaml
- src/
- storage.ts
- lambda.ts
- api.ts
- alarms.ts
- functions/
- handler.ts
- package.json
- package.json
- tsconfig.json
- README.md