How can I update files on Amazon's CDN (CloudFront)?
Solution 1
Amazon added an Invalidation Feature. This is API Reference.
Sample Request from the API Reference:
POST /2010-08-01/distribution/[distribution ID]/invalidation HTTP/1.0
Host: cloudfront.amazonaws.com
Authorization: [AWS authentication string]
Content-Type: text/xml
<InvalidationBatch>
<Path>/image1.jpg</Path>
<Path>/image2.jpg</Path>
<Path>/videos/movie.flv</Path>
<CallerReference>my-batch</CallerReference>
</InvalidationBatch>
Solution 2
Here is how I do it using the CloudFront control panel.
- Select CloudFront from the list of services.
- Make sure Distributions from the top left is selected.
- Next click the link for the associated distribution from the list (under id).
- Select the Invalidations tab.
- Click the Create Invalidation button and enter the location of the files you want to be invalidated (updated).
For example:
- Then click the Invalidate button and you should now see InProgress under status.
It usually takes 10 to 15 minutes to complete your invalidation request, depending on the size of your request.
Once it says completed you are good to go.
Tip: Once you have created a few invalidations if you come back and need to invalidate the same files use the select box and the Copy link will become available making it even quicker.
Solution 3
Set TTL=1 hour and replace
http://developer.amazonwebservices.com/connect/ann.jspa?annID=655
Solution 4
CloudFront's user interface offers this under the [i] button > "Distribution Settings", tab "Invalidations": https://console.aws.amazon.com/cloudfront/home#distribution-settings
Solution 5
Download Cloudberry Explorer freeware version to do this on single files: http://blog.cloudberrylab.com/2010/08/how-to-manage-cloudfront-object.html
Comments
-
Matt about 3 years
Is there any way to update files stored on Amazon CloudFront (Amazon's CDN service)? Seems like it won't take any update of a file we make (e.g. removing the file and storing the new one with the same file name as before). Do I have to explicitly trigger an update process to remove the files from the edge servers to get the new file contents published?
Thanks for your help