2.5 KiB
2.5 KiB
AWS Python S3 Bucket Pulumi Template
A minimal Pulumi template for provisioning a single AWS S3 bucket using Python.
Overview
This template provisions an S3 bucket (pulumi_aws.s3.BucketV2
) in your AWS account and exports its ID as an output. It’s an ideal starting point when:
- You want to learn Pulumi with AWS in Python.
- You need a barebones S3 bucket deployment to build upon.
- You prefer a minimal template without extra dependencies.
Prerequisites
- An AWS account with permissions to create S3 buckets.
- AWS credentials configured in your environment (for example via AWS CLI or environment variables).
- Python 3.6 or later installed.
- Pulumi CLI already installed and logged in.
Getting Started
- Generate a new project from this template:
pulumi new aws-python
- Follow the prompts to set your project name and AWS region (default:
us-east-1
). - Change into your project directory:
cd <project-name>
- Preview the planned changes:
pulumi preview
- Deploy the stack:
pulumi up
- Tear down when finished:
pulumi destroy
Project Layout
After running pulumi new
, your directory will look like:
├── __main__.py # Entry point of the Pulumi program
├── Pulumi.yaml # Project metadata and template configuration
├── requirements.txt # Python dependencies
└── Pulumi.<stack>.yaml # Stack-specific configuration (e.g., Pulumi.dev.yaml)
Configuration
This template defines the following config value:
aws:region
(string) The AWS region to deploy resources into. Default:us-east-1
View or update configuration with:
pulumi config get aws:region
pulumi config set aws:region us-west-2
Outputs
Once deployed, the stack exports:
bucket_name
— the ID of the created S3 bucket.
Retrieve outputs with:
pulumi stack output bucket_name
Next Steps
- Customize
__main__.py
to add or configure additional resources. - Explore the Pulumi AWS SDK: https://www.pulumi.com/registry/packages/aws/
- Break your infrastructure into modules for better organization.
- Integrate into CI/CD pipelines for automated deployments.
Help and Community
If you have questions or need assistance:
- Pulumi Documentation: https://www.pulumi.com/docs/
- Community Slack: https://slack.pulumi.com/
- GitHub Issues: https://github.com/pulumi/pulumi/issues
Contributions and feedback are always welcome!