AWS SDK - No Such Key error when trying to rename a file
I have a rails app that makes direct client-side uploads to S3. The files
go into an uploads bucket I have, and then after validation if
everything's ok with the model they're attached to, I rename and move them
over to a permanent bucket. I've been trying to get this working with the
new sdk in the console and whenever I issue the move_to, or rename_to, or
even copy_to commands, i get an error.
gemfile
gem 'aws-sdk', '~> 1.0'
console
old_key = FileAttachment.find(1).file
AWS.config(access_key_id: ENV['AWS_ACCESS_KEY_ID'], secret_access_key:
ENV['AWS_SECRET_ACCESS_KEY'], region: 'us-east-1')
s3 = AWS::S3.new
bucket = s3.buckets['temp-uploads']
obj = bucket.objects[old_key]
obj.move_to('/uploads/model/id/hi')
AWS::S3::Errors::NoSuchKey: No Such Key
What gives???
No comments:
Post a Comment