appoxy / aws

Amazon Web Services (AWS) Ruby Gem
https://rubygems.org/gems/aws
236 stars 87 forks source link

Signed urls for S3 #16

Open gaffo opened 14 years ago

gaffo commented 14 years ago

I can't find a method to create the signed url for S3. Is there one?

phiggins commented 14 years ago

I don't think the AWS::S3 objects support generating a signed URL, but the lower-level S3Interface class does. See this link: http://rubydoc.info/github/appoxy/aws/master/Aws/S3Interface#get_link-instance_method

tomandersen commented 14 years ago

The generatrors are what you need: bucket_gen = Aws::S3Generator::Bucket.create(s3, bucket)

  a_cloud_item.preview_url = metaBucket_gen.get(itemkey, expiresAt) #=> https://s3.amazonaws.com:443/my_awesome_bucket/my_cool_key?Signature=h...M%3D&Expires=1180820032&AWSAccessKeyId=1...2