Cheapest AWS VPC NAT solution for personal projects.
The current solutions is:
- EC2 running on Spot.
- Auto Healing
- automatically replaces the unhealthy instance.
- re-attaches a persistent network interface to recover transport level details such as routes.
The solution is not:
- Highly Available
- instance unavailability will cause NAT disruption.
- Fault Tolerant
- the persistent network interface results in dependency on a single zone.
STACK_NAME=examples-nat \
PRIVATE_ROUTE_TABLES=rtb-0eee90cf29e333813,rtb-0c1d060b614e74b88 \
PUBLIC_SUBNET=subnet-03ad595bb28ce7679 \
./bin/deploy
I use the AWS System Manager Session Manager to SSH into an instance in a private subnet utilizing the NAT and run:
yum install python python-pip -y \
&& pip install --upgrade pip \
&& pip install speedtest-cli \
&& speedtest-cli
Retrieving speedtest.net configuration...
Testing from Amazon.com (54.206.26.162)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Telstra (Sydney) [1.01 km]: 1.82 ms
Testing download speed................................................................................
Download: 3283.42 Mbit/s
Testing upload speed................................................................................................
Upload: 2274.26 Mbit/s
solution | network | cost/GB | cost/hour** | cost/month** |
---|---|---|---|---|
NAT Gateway | 5-45 Gbps | 0.059 | 0.059 | 42.48 |
NAT Instance (t3a.nano) | 0-5 Gbps | 0-0.114 | 0.0059 | 4.25 |
NAT Instance (t3a.nano) (spot) | 0-5 Gbps | 0-0.114 | 0.0018* | 1.30* |
* variable costs.
** region ap-southeast-2.
- /etc/sysctl.d/10-nat-settings.conf
- /usr/sbin/configure-pat.sh