I’m back with Day 03 of my 30 Days of AWS Terraform Challenge, and today’s lesson was all about creating an Amazon S3 bucket using Terraform. Even though S3 buckets are one of the simplest AWS resources, this exercise actually helped me understand some really important Terraform concepts that I didn’t fully appreciate before.
Here’s a breakdown of what I learned and how I approached this task.
The Terraform Configuration
The setup for this task includes only two blocks: the provider configuration and the S3 bucket resource.
AWS Provider Block
This part tells Terraform which cloud provider and region to use.
provider "aws" {
region = "us-east-1"
}
S3 Bucket Resource Block
This is the actual code that defines the bucket:
resource "aws_s3_bucket" "my_bucket" {
bucket = "amit-terraform-course-bucket-03"
tags = {
Name = "My bucket"
Environment = "Dev"
}
}
A few things clicked for me while writing this:
S3 bucket names must be globally unique, so you can’t use common or repeated names.
The resource name (my_bucket) is only used inside Terraform — it’s not the bucket name on AWS.
Tags are written in a map format, which was a good reminder since some Terraform arguments use strings and others use maps.
Before proceeding, I checked the official Terraform Registry page for aws_s3_bucket. This page explains every argument, optional fields, and example usage. Honestly, using this documentation is becoming a habit now, and it makes things much easier.
Running Terraform Commands
Once the configuration was ready, I followed the usual Terraform workflow:
1. Initialize
terraform init
This downloads the AWS provider plugin and prepares the working directory.
2. Preview Changes
terraform plan
This command shows what Terraform is planning to create. In my case, it displayed:
“1 to add, 0 to change, 0 to destroy.”
3. Apply Changes
terraform apply -auto-approve
And just like that, the S3 bucket was created. I opened my AWS console to confirm, and the bucket (with the correct tags) was there instantly.
4. Destroy (Optional but Good Practice)
terraform destroy -auto-approve
This removes everything created by the Terraform configuration. It’s a handy way to keep your AWS account clean while learning.
This video by Piyush Sachdeva explains how to create an S3 bucket using Terraform in a very beginner-friendly way. He walks through how Terraform reads .tf files, how the AWS provider works, and how to write a clean S3 bucket resource block with tags. He then demonstrates the full Terraform workflow step-by-step — initializing the project, planning the changes, applying the configuration, verifying the bucket in the AWS console, and finally destroying it. If you're new to Terraform, this video gives you a clear, hands-on understanding of how resources are created and managed using Infrastructure as Code.
🔗 Connect With Me
If you enjoyed this post or want to follow my #30DaysOfAWSTerraformChallenge journey, feel free to connect with me here:
💼 LinkedIn: Amit Kushwaha
🐙 GitHub: Amit Kushwaha
📝 Hashnode / Amit Kushwaha
🐦 Twitter/X: Amit Kushwaha



Top comments (0)