๐ Video: Day 3: S3 Bucket Lab
โฑ๏ธ Prerequisite: Day 1 (IaC Concepts) + Day 2 (Providers & init) โ
๐ Repo: github.com/Push/terraform-aws-labs โ /day03/
๐ฏ Goal: Go from .tf file โ live AWS S3 bucket โ update tags โ destroy โ all with Terraform commands.
โ Simplest AWS resource (no dependencies like VPC/subnets)
โ Instant creation (~1 sec)
โ Global namespace โ teaches uniqueness constraints
โ Perfect for learning the Terraform workflow loop:
init โ plan โ apply โ modify โ plan โ apply โ destroy
main.tf for S3 Bucketday03/main.tfterraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 6.7.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
# ๐ชฃ S3 Bucket Resource
resource "aws_s3_bucket" "first_bucket" { # โ Logical name (for Terraform internals)
bucket = "tech-tutorials-push-2025" # โ Must be GLOBALLY unique!
tags = {
Name = "my-bucket"
Environment = "dev"
}
}
| Field | Why It Matters |
|---|---|
bucket |
Must be globally unique across all AWS accounts/regions โ use your name + year |
tags |
Optional, but best practice for cost allocation & filtering |
first_bucket |
Internal reference (e.g., aws_s3_bucket.first_bucket.id) โ name it meaningfully! |
๐ก Pro Tip: Use random provider for unique names in real projects โ coming soon!