跳到正文

Review the New Project ​

Let's review some of the generated project files:

  • index.ts is the Pulumi program that defines your stack resources. Let's examine it.
typescript
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

// Create an AWS resource (S3 Bucket)
const bucket = new aws.s3.Bucket("my-bucket");

// Export the name of the bucket
export const bucketName = bucket.id;

This Pulumi program creates a new S3 bucket and exports the name of the bucket.

typescript
export const bucketName = bucket.id;

Next, you'll deploy your stack, which will provision your S3 bucket.

文档内容翻译自 Pulumi 官方文档。