Provision infrastructure with new aws.s3.Bucket(), stack outputs, ComponentResource abstractions, pulumi.Config, and the Automation API
0 / 5 completed
1 / 5
How do you create an S3 bucket in Pulumi TypeScript?
Pulumi S3 Bucket:import * as aws from '@pulumi/aws'; const bucket = new aws.s3.Bucket('my-bucket', { website: { indexDocument: 'index.html' } }). bucket.bucket is an Output<string> — a lazy value resolved during deployment. Use pulumi.interpolate`s3://${bucket.bucket}` or bucket.bucket.apply(name => ...) to use it in other resources.
2 / 5
What are stack outputs in Pulumi?
Stack outputs:export const bucketName = bucket.bucket; export const apiUrl = api.url. After pulumi up, run pulumi stack output bucketName to read the value. In a StackReference: const infra = new pulumi.StackReference('org/infra/prod'); const vpcId = infra.getOutput('vpcId') — enabling cross-stack dependency injection.
3 / 5
What is a ComponentResource in Pulumi TypeScript?
ComponentResource: Extend pulumi.ComponentResource: class WebApp extends pulumi.ComponentResource { constructor(name: string, args: WebAppArgs, opts?: pulumi.ComponentResourceOptions) { super('my:index:WebApp', name, {}, opts); const bucket = new aws.s3.Bucket(`${name}-bucket`, {}, { parent: this }); } }. The parent: this option nests the child resource under the component in the state tree and UI.
4 / 5
How does pulumi.Config handle environment-specific configuration?
pulumi.Config:const config = new pulumi.Config(); const dbSize = config.get('dbInstanceSize') ?? 'db.t3.micro'. Set with pulumi config set dbInstanceSize db.t3.large. For secrets: pulumi config set --secret dbPassword s3cr3t — Pulumi encrypts the value in the stack state. Access with config.requireSecret('dbPassword') which returns Output<string>.
5 / 5
What is the Pulumi Automation API?
Automation API:import { LocalWorkspace } from '@pulumi/pulumi/automation'. Create a stack: const stack = await LocalWorkspace.createOrSelectStack({ stackName, projectName, program }). Then await stack.up({ onOutput: console.log }). Use cases: multi-tenant SaaS where each customer gets their own Pulumi stack, custom CLI tools, integration test teardown, or a web UI for infrastructure management.