Reputation: 423
It's pretty straightforward but I have this issue: Unexpected error while processing request: undefined method `PresignedPost' for Aws::S3:Module
My objective: Get the presigned URL for an object to which I can perform an upload file.
My gem has
gem 'aws-sdk', '~> 2'
Code:
@@aws_creds = Aws::SharedCredentials.new(profile_name: profile)
Aws.config.update({region: 'us-west-2',credentials: @@aws_creds})
s3 = Aws::S3::Resource.new
@bucket = s3.bucket(bucketName)
form = Aws::S3::PresignedPost(:key => key )
if(form)
form.fields
end
Upvotes: 1
Views: 1375
Reputation: 10566
you normally don't do a standalone presignedpost. you do it using the bucket method.
something like @bucket.presigned_post(:key=>key
)
See doc: http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/PresignedPost.html
Note: Normally you do not need to construct a PresignedPost yourself. See Bucket#presigned_post and Object#presigned_post.
Upvotes: 2