AWS EC2-Other, Data Transfers out

An hourly job to run a iperf3 (a throughput analyzer)

0 * * * *  docker exec -t iperf3-server iperf3 -c 100.24.142.145 || docker restart iperf3-server >> ~/restart_iperf.log

may resulted in this:

And a increase of $20 that month before I caught it. You really need to keep an eye on AWS costs, esp after a change.

I changed it to:

0 * * * *  docker exec -t iperf3-server iperf3 -c $(hostname) || docker restart iperf3-server >> ~/restart_iperf.log

I presume this avoids the fee b/c “100.24.142.145” is a public IP address I lease from AWS, called a elastic IP. For some reason, they don’t check the packet’s source IP, even though I thought they only charged if data leaves their Availability Zone (rack). I have to check if the fix above actually fixes it. $(hostname) returns the machine’s name, which resolves to your AWS Virtual Private Cloud (VPC) address which is internal to just your account, just like the addresses in your SOHO router. So the data should never leaves your EC2 instance.

Leave a Reply

Your email address will not be published. Required fields are marked *