Testing VPC Connectivity¶
| Category | Cloud & AWS Networking |
| Status | โ Completed |
| Repo | nextwork-testing-vpc-connectivity |
| 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 Testing VPC Connectivity 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 5 of the VPC series tests the network. In the guide you SSH into the public server, ping the private one, and curl the internet, then fix the SG and NACL rules that block you. Without real instances, I wrote a small reachability analyzer that reads the actual SG, NACL, and route-table configuration and evaluates each hop. It's the same reasoning AWS Reachability Analyzer automates.
Summary¶
Ran the guide's live connectivity tests on real AWS: ping public โ private (0% loss), public โ internet (HTTP 200), SSH into the private server through the public one, private โ internet blocked, and HTTP to the private server blocked by its security group. Everything was torn down afterwards.
The checks behind this are in docs/verification.txt.
Skills & tools¶
Amazon VPC, Subnets, CIDR, Terraform, Infrastructure as Code, boto3, moto (AWS mock), Amazon EC2, Network troubleshooting, ICMP, Reachability analysis, Python
What I built¶
main.tf: the full VPC, both instances, and an ICMP rule from the public SG to the private SG (the guide's fix for the failed ping).reachability.py: hop-by-hop evaluator for source NACL egress, destination NACL ingress, and destination SG, plus an internet-route check.checks.py: asserts SSH and ping are reachable, HTTP to the private tier is blocked, the public subnet has an internet route, and the private subnet doesn't.
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-testing-vpc-connectivity 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. To get onto the instances I used EC2 Instance Connect with a throwaway SSH key that is only valid for 60 seconds. No key pairs were created in AWS and no keys were saved.
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 13 CHECKS PASSED
$ ./real-extra.sh
--- 1) SSH into the public server, ping the private server (10.0.1.114)
ip-10-0-0-89.ec2.internal
3 packets transmitted, 3 received, 0% packet loss, time 2042ms
rtt min/avg/max/mdev = 0.350/0.889/1.943/0.744 ms
--- 2) public server -> internet (curl example.com)
HTTP 200 from example.com
--- 3) SSH into the private server through the public one (private SG allows 22 only from the public SG)
hello from ip-10-0-1-114.ec2.internal (private subnet)
private -> internet:
HTTP 000
no internet route (expected: private subnet has no 0.0.0.0/0 route)
--- 4) HTTP from public -> private should be blocked by the private SG
blocked/timeout (expected)
Teardown¶
Resources were up from 19:25 to 19:29 CST on 2026-12-02, then destroyed and verified gone:
=== TEARDOWN 2026-12-02 19:27 CST ===
$ terraform destroy -auto-approve -input=false -no-color -var ami_id=ami-000d209a4fc9822c4 -var project_tag=nextwork-testing-vpc-connectivity
Destroy complete! Resources: 16 destroyed.
$ terraform state list (should be empty)
$ aws resourcegroupstaggingapi get-resources --tag-filters Key=Project,Values=nextwork-testing-vpc-connectivity
$ live EC2 instances / volumes / VPCs tagged Project=nextwork-testing-vpc-connectivity (should be empty)
=== teardown verified 19:29 CST ===
Cost¶
Estimated cost of the real run: about $0.01 (two t2.micro instances for about 4 minutes). 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/da091986-ef01-5973-a070-b15e174f59d8 ยท 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: 16 added, 0 changed, 0 destroyed.
igw_id = "igw-d9802c0568e041a76"
private_instance_id = "i-95d74123f0184883c"
private_sg_id = "sg-97a366f6014d0c5ac"
private_subnet_id = "subnet-a33d4aecbb947e409"
public_instance_id = "i-f575a48e77261087d"
public_instance_public_ip = "54.214.52.172"
public_subnet_id = "subnet-96faf394333e4cda1"
vpc_id = "vpc-e90a449404f0ccc07"
web_sg_id = "sg-176c0c1e0a76a609b"
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 instance in public subnet
PASS: private instance in private subnet
PASS: private instance has no public IP
PASS: private SG allows SSH only from the public SG
PASS: public -> private SSH is reachable ({'src NACL egress': True, 'dst NACL ingress': True, 'dst security group': True})
PASS: public -> private ping is reachable (ICMP rule) ({'src NACL egress': True, 'dst NACL ingress': True, 'dst security group': True})
PASS: public -> private HTTP is blocked by the private SG ({'src NACL egress': True, 'dst NACL ingress': True, 'dst security group': False})
PASS: public subnet has an internet route (curl example.com would work)
PASS: private subnet has no internet route
ALL 13 CHECKS PASSED
[exit code 0]