Module 6 · Project 06 · Build AWS Infrastructure with Terraform · Lesson 23 of 48

Build it: a full environment from code

Build the network, servers, load balancer and database with Terraform modules, and test yourself.

In this lesson · about 40 minutes

  • Build Project 06 in stages
  • Use modules and separate environments
  • Explain Terraform in interview language

Build it in stages

  1. Network: VPC, public and private subnets in two availability zones, internet gateway, route tables, security groups.
  2. Compute: an EC2 instance in a private subnet with an IAM role (not access keys), configured at boot with user data or your Project 02 playbook, running your Project 03 container.
  3. Load balancer: an Application Load Balancer in the public subnets, forwarding to the instance; output its DNS name.
  4. Database: RDS Postgres in the private subnets, its password in AWS Secrets Manager, its security group open only to the app's.
  5. Modules and environments: refactor into modules/network, compute, database, security; create environments/dev and staging, each with its own state.
terraform/
├── modules/{network,compute,database,security}/
├── environments/{dev,staging,production}/
│   ├── main.tf  variables.tf  outputs.tf  backend.tf
└── README.md

Break it on purpose

  • Change a security group in the console, then run plan. Did Terraform spot the drift?
  • Change the database's engine version or subnet group and read the plan carefully. Is it ~ or -/+?
  • Run two applies at once from two terminals. What does the lock do?

Cost: NAT gateways, load balancers and RDS cost money every hour. Use the smallest sizes, run terraform destroy when you're done for the day, and set an AWS budget alert (Project 15).

Flashcards

Project 06 flashcards

0 of 7 known

Say the answer out loud, flip the card, then be honest: cards you miss come back at the end.

7 left in the deck

Practice exam

Project 06 practice test

Eight questions, 10 minutes.

  • 8 questions · 10 minutes
  • No feedback until you submit. Flag questions to come back to them.
  • Aim for 85% or better before you move on. The real exam's 750 out of 900 is roughly 80–83%.

Write the 'Architecture' and 'Cost' sections for your Terraform project.

Consider these questions and write down your thoughts. What you write stays on this device.

Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.