Skip to main content

Command Palette

Search for a command to run...

Infrastructure as Code: Provisioning EC2 and S3 Using Terraform on AWS

Updated
β€’2 min read

Welcome to another part of my cloud journey! This week was all about stepping into the world of Infrastructure as Code (IaC) using Terraform. Instead of manually clicking through the AWS Console, I learned how to automate the provisioning of infrastructure using code β€” and it felt like unlocking a superpower. πŸš€


πŸ“˜ What This Week Was About

I focused on using Terraform to provision two core AWS resources:

  • An EC2 instance (a virtual machine in the cloud)

  • An S3 bucket (AWS’s object storage service)

It marked my shift from doing things manually to describing my infrastructure in code β€” making deployments faster, consistent, and repeatable.


🧠 What I Did

Here’s what I tackled during the week:

  1. Installed Terraform CLI
    β†’ Got Terraform set up locally.

  2. Configured Terraform to use AWS
    β†’ Used an IAM user with programmatic access (access key and secret key).

  3. Created core Terraform files

    • main.tf: Defined my EC2 instance and S3 bucket.

    • variables.tf: Declared input variables for flexibility.

  4. Deployed Infrastructure

    • Ran terraform init, terraform plan, and terraform apply to spin everything up.
  5. Bonus: I automated S3 event notifications using Terraform β€” integrating knowledge from Week 2!


βš™οΈ Tools I Used

  • Terraform CLI

  • AWS IAM User (with appropriate permissions)

  • EC2 & S3 Services


πŸš€ Why This Was So Powerful

  • πŸ” Repeatability: I can now recreate environments with a single command.

  • πŸ“œ Version control: My infrastructure is now stored in code, tracked in Git.

  • πŸ’Ό Real-world skills: This is exactly what DevOps and Cloud Engineers do daily.

Terraform opened a new door β€” from messy, manual setups to clean, consistent, and scalable infrastructure deployment.