I want to make sure I have the correct usecase for AWS Cloudfront.

Typically I believe it is used to cache static assets, such as those put in AWS S3 storage.

For example, it may end up looking like this, in front of S3:

Aamazon Cloudfront In Front of S3

But I want my application to server different content based on geolocation. So I've put a Cloudfront in front of my ELB as well, so it can forward the CloudFront-Viewer-Country header to my ELB, to my EC2 (where my application sits).

But this application needs to be passed query strings, cookies (for logins) and allow post requests, etc etc that make the cache not really work / slow down the cache / aren't cached. So basically, if I'm just using the cache for geolocation and not much else, is there a way to configure it for this? Is it considered bad practice to put a cache like this in front of a dynamic application that will just water it down? It seems like a bad use case to just use it for geolocaton and not really to cache requests, especially if I have images in an S3 as well behind a separate CloudFront? Or is this fine? Can Cloudfront do full HTML caching so my server/database is almost never hit as an added bonus to geolocation to add more to its usecase when in front of an ELB?

Geolocation is a requirement for me, just not sure that Cloudfront is the right tool, or at the very least I want to make sure I'm not impacting performance by using it this way... if I'm basically paying for it to do geolocation and not serve as a cache in this case that's fine with me, I just don't want it to have an adverse effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.