I've recently been playing with CloudFront's new Invalidation feature and had some time to add it to boto. There's still a few things left to add, but you can perform a general invalidation now using boto:
>>> import boto
>>> cf = boto.connect_cloudfront()
>>> cf.create_invalidation_request("distribution_id", ["/path1","/path2"])
This will automatically invalidate any URLs you pass in. You can also use the "cfadmin" command line tool to invalidate paths without running a python shell:
% cfadmin invalidate static.coredumped.org\
.s3.amazonaws.com /path1 /path2
You can use either the origin or the distribution id as the first parameter to the "invalidate" function.
Note that Amazon limits how many invalidations you can have running at any given time, and they also only let you invalidate so many files with one request. This should be used only to remove things on a non-regular basis (i.e. mistakes or Copyright Infringement notices). You can still use the cachecontrol headers to determine how long files are cached in cloudfront.
Comments
Thanks!