https://aws.amazon.com/blogs/networking-and-content-delivery/calculating-data-transfer-leveraging-amazon-vpc-flow-logs/


There are several factors that contribute towards your overall costs incurred in AWS cloud. When it comes to networking, many customers ask about data transfer charges. You pay a Data Transfer charge when you send data out from AWS to Internet, between AWS Regions, or between Availability Zones (AZ).

Today, there are multiple ways to determine your overall costs in AWS. When your cost and usage go above a certain budget limit, you can use services like AWS Cost Explorer or AWS Cost & Usage Reports to understand what factors are affecting your costs. The AWS web page on Cloud Economics is a fantastic resource for a detailed, holistic look at your environment and can help you identify areas where optimization will make the most difference. However, these resources and solutions do not provide real-time updates for data transfer, or any details on the actual resources (or IP addresses) that contribute towards the data transfer costs between Availability Zones.

In this post, we will look at a solution that uses VPC flow logs to evaluate data transfer between the Availability Zones where your Amazon Virtual Private Clouds (VPCs) sit inside a Region. This solution is good for environments that have chatty applications distributed across multiple Availability Zones that are transferring a lot of data between them. We use the Contributor Insights feature of Amazon CloudWatch to analyze your data transfer. We use the results to calculate cost estimates in real time. The time-series visualizations created by CloudWatch show the top factors influencing your data transfer. The solution shown in this post also publishes the data transfer estimates as a CloudWatch Contributor Insight metric. This metric is set up with an alarm and integrated with your notification system—triggering an alarm when a metric crosses certain threshold. We designed our solution for a multi-account setup.