Created
April 24, 2013 05:21
-
-
Save jp/5449809 to your computer and use it in GitHub Desktop.
Generate cloudfront signed URL from a bucket
This file contains hidden or 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
CONNECTION = Fog::Storage.new({ | |
:provider => 'AWS', | |
:aws_access_key_id => S3_STREAMING_BUCKET[:key], | |
:aws_secret_access_key => S3_STREAMING_BUCKET[:secret], | |
:region => S3_STREAMING_BUCKET[:region] | |
}) | |
S3 = CONNECTION.directories.get(S3_STREAMING_BUCKET[:bucket]) | |
S3.files.each do |file| | |
puts file.key | |
path = AWS::CF::Signer.sign_path( | |
file.key, | |
:expires => 1.day.from_now | |
) | |
puts S3_STREAMING_BUCKET[:streaming_distribution] + "/cfx/st/" + path | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment