I just learned that you can back a Rails app's static assets (HTML, CSS, JS, IMAGES) with Amazon Cloudfront... I read an article here that describes the process pretty well.
http://blog.codeship.io/2012/05/18/Assets-Sprites-CDN.html
I have a few questions about this CDN setup:
1> I have almost the same use case but I dont want to serve ALL my static-pre-generated (semi-dynamic) html from CloudFront CDN... I have something like 200 Million html files ~7Kb each.. so thats approximately a 1333 GB!! (search engine on rails) .. however, only 10% of those files are frequently requested by my site users.. so thats a more manageable 130 GB (long tail). The 130 GB costs about $77/month every time it leaves CloudFront (with request costs and a little leeway factored in).. but the 1300 GB costs about $770/month.. I would like to pay 90% less and only cache the data that is being frequently accessed..
2> Can I possibly only cache in cloudfront, the 10% of my dataset that is being frequently accessed? And serve the rest from my server as needed?
3> On a good day, with your current setup, my cloudfront will only have 133GB of data going out (assuming only 1 request per frequently accessed file). But on a bad day, say if a crawler requests all of my links.. it will have 1333GB of data.. How can I not overpay?