92 lines
2.5 KiB
Markdown
92 lines
2.5 KiB
Markdown
# 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
|
||
|
||
1. Generate a new project from this template:
|
||
```bash
|
||
pulumi new aws-python
|
||
```
|
||
2. Follow the prompts to set your project name and AWS region (default: `us-east-1`).
|
||
3. Change into your project directory:
|
||
```bash
|
||
cd <project-name>
|
||
```
|
||
4. Preview the planned changes:
|
||
```bash
|
||
pulumi preview
|
||
```
|
||
5. Deploy the stack:
|
||
```bash
|
||
pulumi up
|
||
```
|
||
6. Tear down when finished:
|
||
```bash
|
||
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:
|
||
```bash
|
||
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:
|
||
```bash
|
||
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! |