Skip to content

Cloudfront EU-DataTransfer-Out-Bytes cost incurred in unexpected region

0

We are hosting a website and distributing it via Cloudfront. All resources for the website are hosted in the AWS region eu-central-1. We were surprised to find out, that in AWS Cost Explorer the majority of our Cloudfront costs are incurred as EU-DataTransfer-Out-Bytes in the region eu-west-1. Our userbase is mostly in eu-central-1 and there should not be this much EU-DataTransfer-Out-Bytes.

Upon further investigation we discovered that the Cloudfront "Viewers" dashboard shows the majority of requests (96%) originating from the US, specifically only one state. We checked a sample of Cloudfront requests via Athena query, but the "c_ip" value is always an IP from eu-central-1.

Little aside: Unfortunately we are mandated behind a corporate firewall, hence our users don't go directly via Cloudfront, but instead are routed through said firewall, then over our own gateway component (hosted in eu-central-1) onwards to Cloudfront. That is why the "c_ip" for all requests in Cloudfront is always the same. But as I said, that IP is located in eu-central-1, so it should not cause EU-DataTransfer-Out-Bytes, right?

Is this something in our setup or is it maybe an AWS billing technicality?

Best regards, George

1 Answer
1

The situation you're experiencing is likely due to a combination of factors related to how CloudFront operates and how data transfer is billed. Let me explain:

  1. Edge Location vs. Region: The EU-DataTransfer-Out-Bytes you're seeing in eu-west-1 doesn't necessarily mean the data is being served from that region. CloudFront uses edge locations, which are distributed globally and may not correspond directly to AWS regions. The "EU" prefix in the billing could represent any European edge location.

  2. Request Routing: CloudFront routes requests to the nearest edge location based on network conditions and availability, not necessarily the closest geographical location. Even if your users are primarily in eu-central-1, they might be served by edge locations in eu-west-1 if that provides better performance.

  3. Corporate Firewall and Gateway: Your setup with a corporate firewall and gateway in eu-central-1 complicates things. While the c-ip in your logs shows eu-central-1 (your gateway's IP), the actual user requests might be coming from various locations. CloudFront may be detecting the origin of requests before they hit your gateway.

  4. Viewer Location Discrepancy: The fact that your CloudFront "Viewers" dashboard shows 96% of requests originating from the US, specifically one state, is puzzling. This could be due to how your corporate firewall or gateway is configured, possibly using a US-based proxy or VPN endpoint.

  5. Billing Technicality: There's a possibility that this is related to how AWS accounts for data transfer. The eu-west-1 region might be used as a billing aggregation point for European CloudFront traffic.

To further investigate:

  1. Check the x-edge-location field in your CloudFront logs. This will show which edge locations are actually serving the content.

  2. Verify if there are any VPNs or proxies in your corporate network that might be routing traffic through the US before it reaches your gateway.

  3. Consider enabling Real-Time Logs in CloudFront for more detailed insights.

  4. Reach out to AWS Support for clarification on the billing, especially regarding the discrepancy between the viewer location and the billed region.

Remember, CloudFront's global nature means that data transfer charges don't always align with the geographical location of your origin or users. The system is designed to optimize content delivery, which can sometimes lead to unexpected, but not necessarily incorrect, billing patterns.
Sources
Interpret your AWS bill and usage reports for CloudFront - Amazon CloudFront
Understanding data transfer charges - AWS Data Exports
How to Determine Request Region and Granular Usage Statistics for Each Client in CloudFront | AWS re:Post
Issue with Geographic Restrictions on CloudFront Distribution | AWS re:Post

answered 2 years ago

EXPERT

reviewed 2 years ago

  • There are some helpful pointers here already. I checked the x-edge-location and it is always one beginning with "FRA", so clearly located in eu-central-1. Our corporate firewall is a locally installed hardware (non-cloud). I cannot imagine it masking the request as coming from a different region.

    Regarding point 3: How would Cloudfront detect the origin of the request, before it hits our gateway? The gateway receives an "x_forwarded_for" header, but I could not detect any US IPs in there from the sample that I checked.

    I will also try AWS support for the billing part.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.