• About Me
  • Projects
  • WebApp
  • Archive

Barnaby Baron. Exploring AWS.

  • Building a VPC using IaC with Terraform

Building a VPC using IaC with Terraform

2024-04-07 3 min read Projects Barny Baron

Journey: 📊 Community Builder 📊

Subject matter: Building on AWS

Task: Build a VPC using IaC via Terraform.

In this article, we build a VPC!

Within this VPC, there are Public and Private subnets, an Internet Gateway, a security group, custom route tables, and a NAT Gateway.

Within the 6 Pillars of the AWS Well-Architected Framework, Operational Excellence will be achieved by using Terraform to deliver an Infrastructure as Code pipeline.

I also plan on doing a similar project using CloudFormation.

The first question is, why?

I have probably completed well over 100 Cloud Quest labs, which has given me a large amount of hands-on experience with many of the products and services AWS offers.

However, one thing that I never had to do was set up the environment from scratch.

With Cloud Quest, the labs are pre-configured and launched as a self-contained environment. Your goal is to use the course material to navigate around the service and then once you have configured the various areas via documented guidance, you have to fix or configure an area to successfully pass the lab quest.

I was very aware that I hadn’t built a VPC.

So I decided to do just that.

AWS

Credit: This architecture was created using guidance from Prashant Bhatasana on Medium Here

I also used help from Flavius Dinu Here

What did I use to build this environment?

  • Visual Studio Code platform
  • Terraform
  • AWS CLI

What is built?

  • Amazon VPC
  • Public and Private subnets
  • Security Groups
  • Custom Route Tables
  • Internet Gateway
  • NAT Gateway

As I can build and destroy this environment as I need it to ensure healthy cost optimisation, I plan on using this environment for some other projects as I need to so it effectively becomes a multi-project!

In a production environment, I would also ensure we had resiliency with instances spanning Multiple AZs.

Some of the highlights…

The VPC builds:

VPC Built

AWS Management Console view:

VPC

Subnets:

Subnets

Route Tables:

Route Tables

NAT Gateway:

NAT

Internet Gateway:

IGW

Elastic IP:

EIP

Then… time for IaC destruction!!

Terraform

My interpretation of the architecture:

[including an EC2 instance serving as a Web Server and a Database instance for illustrative purposes]

Architecture

Troubleshooting required

I ran into a couple of issues, one of which I documented here: Troubleshooting a Terraform VPC build conflict

I hope you have enjoyed the article, I enjoyed the build!

Cloud

Community Builder VPC Terraform
Latest posts
  • Designing a Formula 1 Race Track and gaining insights from Amazon Nova
  • Year 2 - AWS Community Builder
  • Troubleshooting an EKS Pod creation error - Persistent Volume Controller Failed Binding
  • Building an EKS cluster and mounting an S3 bucket within a pod using the CSI Driver
  • Sopra Steria Merch Delivery!
  • AWS Community Builders Application Window!
  • Building a VPC and provisioning an EC2 instance using Modules!
Categories
  • AWS News (84)
  • Projects (29)
  • Exploring (19)
  • Troubleshooting (10)
  • General (8)
  • Quotes (5)
  • Video (3)
Social media
Archive
© 2025 by Barny Baron
Powered by Bilberry Hugo Theme