- Newest
- Most votes
- Most comments
Your understanding is true on your server and Binance server communicating using Public IP is charged at $0.01 in both directions. While any Traffic IN from Internet is free, 2 EC2 communicating over Public IP doesn't get routed via internet, it takes AWS's private network. Refer: Billing section under https://aws.amazon.com/vpc/faqs/.
Now to answer your question on how can you optimize, getting 2 EC2 to communicate via Public IP is anti-pattern. You must use Private IP (again both EC2 should be in same AZ, to avoid inter-AZ charges). In your use case you may not be able to use Private IP. So, I really don't see any option to optimize further.
Your understanding is partially correct, but there are some important clarifications to make:
-
Data Transfer IN from the internet to Amazon EC2 is generally free. This includes data coming from external sources like Binance, regardless of whether they are hosted on AWS or not.
-
The charges you're referring to for data transfer "in" and "out" using public or Elastic IPv4 addresses within the same AWS Region apply to traffic between AWS resources, not traffic from the internet.
-
In your scenario with Binance, assuming their servers are not part of your AWS infrastructure:
- If you're subscribing to Binance market data from the internet, the incoming data to your EC2 instance would be free.
- You would only incur charges for any data you send out to the internet or between different Availability Zones within AWS.
-
The $0.01/GB charge for data transfer between Availability Zones in the same region applies when you're transferring data between your own resources in different AZs, not for incoming internet traffic.
-
IPv6 data transfer charges only apply when transferring between different VPCs, not for internet traffic.
To reduce bandwidth costs when subscribing to the Binance server:
- Ensure your EC2 instance is in the most appropriate region to minimize latency and potential cross-region data transfer charges.
- If possible, use a single EC2 instance to receive and process the data, avoiding unnecessary internal data transfers.
- Be mindful of any outbound data you might be sending, as that would incur charges.
Remember, while inbound data from the internet is generally free, you should always monitor your usage and costs to avoid any unexpected charges.
Sources
Regional data transfer charges | AWS re:Post
Community | Optimizing Network Traffic and Cost in AWS During Migration
Can someone explain data transfer charges in detail? | AWS re:Post
Data Transfer IN from the internet to Amazon EC2 is generally free. This includes data coming from external sources like Binance, regardless of whether they are hosted on AWS or not.I think this is incorrect according to my
Cost Explorer, thePublicIP-Inis the major cost when I group my cost byAPI operation.
Relevant content
- asked a year ago
- asked 3 years ago
- asked 6 months ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated a month ago

@bsonika: Let's say an EC2 instance (in private subnet) sends data via Nat-Gateway-X in the same AZ. The destination is a public-IP in the same region. In this case will Nat-Gateway-X incur an additional public IP data-transfer charge ($0.01/GB), and the EC2 instance on the destination side as well?