Skip to content

VPC Traffic Flow and Security

Category Cloud & AWS Networking
Status โœ… Completed
Repo nextwork-vpc-traffic-flow-and-security
Original NextWork guide nextwork.ai

Learning project

Practice work following a NextWork guide, separate from my production projects.

๐Ÿ“š NextWork learning project. This is a practice project I built while working through NextWork's VPC Traffic Flow and Security guide. It is part of my Learning portfolio and is fully separate from my production projects.

Category: Learning โ€บ Cloud & AWS Networking
Status: โœ… Completed

Overview

Part 2 of the VPC series adds the traffic controls. A route table sends internet-bound traffic to the IGW. A stateful security group allows HTTP at the resource level. A stateless network ACL guards the subnet boundary.

Summary

Deployed for real on AWS: the public route table (0.0.0.0/0 โ†’ IGW), the web security group (HTTP 80) and a custom network ACL. 8/8 checks passed against the live account, then everything was torn down.

The checks behind this are in docs/verification.txt.

Skills & tools

Amazon VPC, Subnets, CIDR, Terraform, Infrastructure as Code, boto3, moto (AWS mock), Route tables, Security groups, Network ACLs

What I built

  • main.tf: Part 1 resources, plus a public route table and association, a security group (HTTP in, all out), and a custom NACL.
  • checks.py: verifies the default route goes to the IGW, the SG has the HTTP rule, and the custom NACL is associated.

How to run

pip install -r requirements-dev.txt   # moto (local AWS mock) + boto3
./local-test.sh                       # terraform apply against the mock, run checks.py, then destroy

# Real AWS (costs money; use your own IAM user/profile):
terraform init && terraform apply      # mock_endpoint defaults to "" = real AWS
terraform destroy                      # clean up when done

Verification

I ran the verification command on 2026-12-02. The full output is in docs/verification.txt.

PATH=/workspace/nextwork-portfolio/.venv/bin:$PATH TF_PLUGIN_CACHE_DIR=/workspace/nextwork-portfolio/tf-plugin-cache ./local-test.sh

Notes

  • Security groups vs NACLs: SGs are stateful, allow-only, and attach to ENIs. NACLs are stateless, ordered allow/deny rules, and attach to subnets.
  • A custom NACL denies everything by default. The console wizard adds allow-all rules, and I mirrored that here.

Real AWS deployment (2026-12-02)

I deployed this project to a real, dedicated AWS learning account (us-east-1, kept separate from everything else I run), checked it, captured the output, and tore it all down right after. Every resource carried the tag Project=nextwork-vpc-traffic-flow-and-security so I could prove nothing was left behind.

How I ran it: ./real-aws-run.sh (in this repo) does terraform init/apply with my AWS profile, runs checks.py against the real account, runs real-extra.sh for the live tests, and then always runs terraform destroy, even if a step fails.

Evidence (excerpt; the full, sanitized transcript is in docs/aws-real-run.txt, with the account ID redacted):

$ python3 checks.py   (against the real account)
ALL 8 CHECKS PASSED

Teardown

Resources were up from 19:19 to 19:20 CST on 2026-12-02, then destroyed and verified gone:

=== TEARDOWN 2026-12-02 19:20 CST ===
$ terraform destroy -auto-approve -input=false -no-color -var project_tag=nextwork-vpc-traffic-flow-and-security
Destroy complete! Resources: 7 destroyed.
$ terraform state list   (should be empty)
$ aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=nextwork-vpc-traffic-flow-and-security

Cost

Estimated cost of the real run: $0.00 (route tables, security groups and NACLs are free). The account has a $50/month budget with email alerts at $5, $20 and $40, and the whole AWS series is logged in a private spend ledger.


Original project: https://nextwork.ai/projects/fe5ed473-5874-57e1-a58f-d9b3d652330c ยท Part of my NextWork Learning portfolio (hub).

Verification output

From docs/verification.txt:

$ PATH=/workspace/nextwork-portfolio/.venv/bin:$PATH TF_PLUGIN_CACHE_DIR=/workspace/nextwork-portfolio/tf-plugin-cache ./local-test.sh

Success! The configuration is valid.

Apply complete! Resources: 7 added, 0 changed, 0 destroyed.
igw_id = "igw-8a4bc09ff8b25c44d"
public_subnet_id = "subnet-979fdf4cb8fff1f52"
vpc_id = "vpc-4c1138175d5d379ef"
web_sg_id = "sg-c199cfb5baffd2040"
PASS: VPC CIDR is 10.0.0.0/16
PASS: public subnet 10.0.0.0/24 in VPC
PASS: public subnet auto-assigns public IPs
PASS: IGW attached to VPC
PASS: public subnet has its own route table
PASS: default route 0.0.0.0/0 -> IGW
PASS: SG allows HTTP 80 from anywhere
PASS: custom NACL associated with public subnet
ALL 8 CHECKS PASSED

[exit code 0]