Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to limit CloudFront to a specific region?

I'm using CloudFront on top of a S3 bucket mostly to help me reduce the cost my hosting bill.

10000 HTTP Requests on S3 cost $0.01 on US Standard Region and same requests cost 0.0075 on CloudFront's US region.

I see that CloudFront automatically uses the closest region to the end user and therefor I see in some cases heavy use of some expensive regions such South America, Asia, Australia, etc. It makes sense since the idea of CloudFront is to decrease loading time.

The point is that I originally expected to reduce the cost to a level that I'm not nearly near at and - probably by just looking at my numbers - I'll probably end up paying even more than before.

My question is. Is there any way I can limit CloudFront availability only to US Region so everyone will default to it?

I read their FAQs and couldn't find any info related to it.

like image 534
Martin Avatar asked Sep 13 '26 05:09

Martin


1 Answers

"I see that CloudFront automatically uses the closest region to the end user"

You're mixing up your information here. CloudFront automatically uses the closest edge location to the end user.

S3 buckets only live in a single region. If you tell CloudFront to create a distribution for an S3 bucket in the us-east-1 region, then CloudFront will always pull from that bucket in that region.

CloudFront then copies the data from that region-locked bucket to an edge location that is closer to the end user.

In that way, you only pay for S3 costs for the region the bucket is in, plus whatever the CloudFront costs are.

Make sense?

like image 143
Ryan Parman Avatar answered Sep 14 '26 18:09

Ryan Parman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!