Creating a Private Subnet¶
| Category | Cloud & AWS Networking |
| Status | โ Completed |
| Repo | nextwork-creating-a-private-subnet |
| 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 Creating a Private Subnet 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 3 of the VPC series. A private subnet is one whose route table has no path to the internet gateway. A dedicated NACL that only admits traffic from the public subnet locks it down further.
Summary¶
Deployed for real on AWS: a private subnet with its own route table (no internet route) and a NACL that only admits the public subnet. 11/11 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), Private subnets, Defense in depth
What I built¶
main.tf: Parts 1โ2, plus private subnet 10.0.1.0/24, a private route table, and a private NACL limited to 10.0.0.0/24.checks.py: confirms no 0.0.0.0/0 route, no auto public IP, and that the NACL only admits the public subnet.
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
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-creating-a-private-subnet 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 11 CHECKS PASSED
Teardown¶
Resources were up from 19:21 to 19:22 CST on 2026-12-02, then destroyed and verified gone:
=== TEARDOWN 2026-12-02 19:22 CST ===
$ terraform destroy -auto-approve -input=false -no-color -var project_tag=nextwork-creating-a-private-subnet
Destroy complete! Resources: 11 destroyed.
$ terraform state list (should be empty)
$ aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=nextwork-creating-a-private-subnet
Cost¶
Estimated cost of the real run: $0.00 (networking objects only, no hourly resources). 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/4e96e29d-98b8-551e-ae93-da39c36e30fd ยท 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: 11 added, 0 changed, 0 destroyed.
igw_id = "igw-41b8a9467e1f5501d"
private_subnet_id = "subnet-22a0ef833cb36c035"
public_subnet_id = "subnet-9684e71834b305cad"
vpc_id = "vpc-2365f5f7c6dd68d56"
web_sg_id = "sg-af454eecd894fa85d"
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
PASS: private subnet 10.0.1.0/24 does not auto-assign public IPs
PASS: private route table has NO internet route
PASS: private NACL only admits the public subnet
ALL 11 CHECKS PASSED
[exit code 0]