CloudFront is a great cost effective Content Delivery Network (CDN). When it first started it only supported files located on Amazon’s Simple Storage Service (S3) and on November 2010 Amazon releasedthe “Origin Pull” feature. Origin Pull allows defining a CDN distribution that pull content directing from a preconfigured site (preconfigured hostname) instead of pulling the content from S3.

The benefits of using the Origin Pull feature includes:
- No need to sync an S3 bucket with your static resources (CSS, Images, Javascripts)
- You can serve via the CDN dynamically generated content (like modified images or text fiels) without pre-generating it and putting it inside an S3 bucket.
- You need to call it on each object
- First 1,000 requests are free, each additional one will cost $0.005.
- It may take up to 15 minutes for the cache to actually clear from all edge locations
What are versioned URLs?
Versioned URLs granularity
You can determine the granularity of the version value to suite your needs. The granularity will allow you to invalidate as little as one file, or every file served via the origin pull in your application.
- A value determined by the build version (i.e. invalidate all static CSS, JS and images one every new build deployed)
- A value in the configuration, updated automatically or manually to invalidte parts or all of the objects
- An automatically generated value per file determined by the file content by utilizing a hash function
- An automatically generated value per file determined by its last modification date
CloudFront will disregard URL query string versioning
- CloudFront will disregard a versioned URL of the following format and consider both URLs the same resource:
- http://cdn.example.com/css/myfile.css?v123
- http://cdn.example.com/css/myfile.css?v333
- CloudFront will consider these 2 URLs 2 different resources:
- http://cdn.example.com/css/v123/myfile.css
- http://cdn.example.com/css/v333/myfile.css
I would recommend using CloudFront or any other CDN supporting origin pull in any project as it will significantly reduce the loading time of your pages with minimal cost and reduce the load on your servers. It’s a great, quick and easy way to make your site (or even API) work much better.