Created
September 15, 2010 14:49
-
-
Save peplin/580833 to your computer and use it in GitHub Desktop.
Set the default root object on a CloudFront distribution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Need to serve some static HTML files, but can't use S3 because it won't | |
resolve index.html for you? Grab a CloudFront distribution from Amazon, point it | |
to your bucket, and set your index.html as the "default root object". | |
This code snippet uses the boto (http://code.google.com/p/boto/) Python package | |
to set the default root object on your distribution. | |
Christopher Peplin, chris.peplin@rhubarbtech.com | |
""" | |
from boto.cloudfront import CloudFrontConnection | |
c = CloudFrontConnection('YOUR_ACCESS_KEY', 'YOUR_SECRET_KEY') | |
c.get_all_distributions() | |
# Assuming you only have on distribution, otherwise find yours in the list | |
d = c.get_all_distributions()[0] | |
i = d.get_distribution() | |
i.config.default_root_object = "index.html" | |
i.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment