AWS Deployment with Terraform: From Installation to Cleanup

I am a software engineer who has a keen interest in the business. Currently, I am learning flutter.
A quick guide to deploy and destroy your first AWS resource using Terraform.
Prerequisites
AWS Account with programmatic access (Access Key + Secret Key)
Terminal access on macOS/Linux
Step 1: Install AWS CLI
# Install via Homebrew (macOS)
brew install awscli
# Or download from AWS documentation
Step 2: Configure AWS Credentials
aws configure
Enter your:
AWS Access Key ID
AWS Secret Access Key
Default region (e.g.,
ap-south-1)Output format (
json)
Verify configuration:
aws configure list
Step 3: Install Terraform
# Install via Homebrew (macOS)
brew install terraform
# Verify installation
terraform --version
Step 4: Create Terraform Configuration
Create main.tf:
provider "aws" {
region = "ap-south-1"
}
resource "aws_s3_bucket" "my_poc_bucket" {
bucket = "this-is-wed-third-june"
}
output "bucket_name" {
value = aws_s3_bucket.my_poc_bucket.bucket
}
Note: S3 bucket names must be globally unique. Replace with your own name.
Step 5: Initialize Terraform
terraform init
Downloads the AWS provider plugin.
Step 6: Preview Deployment
terraform plan
Shows resources to be created without making changes.
Step 7: Deploy to AWS
terraform apply
Type yes to confirm. Creates the S3 bucket.
Verify in AWS:
aws s3 ls
Step 8: View Deployed Resources
terraform show
Displays current state and all resource details.
Step 9: Clean Up
terraform destroy
Type yes to delete all Terraform-managed resources.
Summary
| Command | Purpose |
|---|---|
aws configure |
Set up AWS credentials |
terraform init |
Initialize provider plugins |
terraform plan |
Preview changes |
terraform apply |
Deploy resources |
terraform show |
View current state |
terraform destroy |
Remove all resources |
Your infrastructure is now code - version it, review it, and keep it clean!


