Pulumi AWS

7.24.0 · active · verified Thu Apr 09

Pulumi AWS is a Python package that enables users to define, deploy, and manage Amazon Web Services (AWS) cloud resources using Python code. It is the most widely used provider in the Pulumi ecosystem and offers access to the full surface area of the upstream Terraform AWS Provider. The library is actively maintained with frequent minor and patch releases, typically tied to updates in the underlying Terraform AWS Provider, with major versions released periodically to incorporate significant upstream changes and Pulumi-specific enhancements.

Warnings

Install

Imports

Quickstart

This quickstart code defines a basic AWS S3 bucket using `pulumi_aws`. It demonstrates importing the necessary modules, creating a resource, and exporting an output. To run this, ensure the Pulumi CLI is installed and configured for AWS credentials (e.g., via `~/.aws/credentials` or environment variables like `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`). You would typically initialize a Pulumi project (`pulumi new python`), save this code in `__main__.py`, set the AWS region (`pulumi config set aws:region us-east-1`), and then deploy (`pulumi up`).

import pulumi
import pulumi_aws as aws
import os

# Configure the AWS region using Pulumi config or environment variables.
# For example: pulumi config set aws:region us-east-1
# Or set AWS_REGION environment variable.

# Create an AWS S3 bucket. Pulumi automatically suffixes the name for global uniqueness.
bucket = aws.s3.Bucket("my-unique-bucket",
    tags={
        "Environment": os.environ.get('PULUMI_ENVIRONMENT', 'development'),
        "Project": "MyPulumiApp"
    }
)

# Export the name and website endpoint of the bucket
pulumi.export('bucket_name', bucket.id)
pulumi.export('bucket_arn', bucket.arn)

view raw JSON →