This repository contains Terraform configuration to create an AWS S3 bucket. The configuration is flexible, allowing you to define bucket properties such as versioning, access control, and encryption. 🛠️
- ✅ Creates an S3 bucket with customizable settings.
- ✅ Supports versioning for object history.
- ✅ Enables server-side encryption for data security.
- ✅ Allows configuration of bucket policies and access controls.
- ✅ Easily extendable for logging or lifecycle policies.
Before using this configuration, ensure you have:
- 🖥️ Terraform installed (v1.0 or later).
- 💻 AWS CLI installed and configured with appropriate permissions.
- 🔑 An AWS IAM user or role with
s3:CreateBucketands3:PutBucket*permissions.
git clone https://github.com/yourusername/terraform-s3-bucket.git
cd terraform-s3-bucketUpdate the terraform.tfvars file or pass variables during the apply step. Here are the primary variables you can customize:
bucket_name = "my-unique-bucket-name" # Replace with your unique bucket name
enable_versioning = true # Set to true to enable versioning
enable_encryption = true # Set to true for server-side encryptionInitialize the Terraform workspace by running:
terraform initRun the following command to create the S3 bucket:
terraform applyType yes when prompted to approve the changes.
After applying, the following outputs will be available:
- Bucket Name: The name of the created S3 bucket.
- Bucket ARN: The Amazon Resource Name (ARN) of the S3 bucket.
- Bucket Region: The region where the bucket is created.
Example:
Bucket Name = my-unique-bucket-name
Bucket ARN = arn:aws:s3:::my-unique-bucket-name
Bucket Region = us-west-1To delete the S3 bucket and all associated resources, run:
terraform destroyContributions are welcome! Feel free to fork this repository, make improvements, and open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- User-Friendly Structure: Includes sections like features, prerequisites, usage, and outputs.
- Customization: Mentions key customizable variables.
- Clear Instructions: Provides step-by-step guidance for setup, usage, and cleanup.
- Engaging Emojis: Adds visual appeal and organizes content effectively.