Pretty simple stuff (I thought). I'm attempting to create a pre-signed url that I can then use to download a file. The IAM user these keys correspond to have fullS3Acess until I can figure out why this signature isn't working.
def presigned_url
document = Document.find(params[:id])
signer = get_presigner
signer.presigned_url(:get_object, bucket: ENV['S3_BUCKET_NAME'], key: document.s3_path)
end
def get_presigner
credentials = Aws::Credentials.new(
ENV['FULL_AWS_ACCESS_KEY_ID'],
ENV['FULL_AWS_SECRET_ACCESS_KEY']
)
client = Aws::S3::Client.new(
region: 'us-west-2',
credentials: credentials
)
Aws::S3::Presigner.new(client: client)
end
The url returned from the presigned_url method results in a SignatureDoesNotMatch error when I attempt to open it in a browser. Any ideas as to why that is true? I think I've ruled out permissions as the answer, as I've increased that user's IAM permissions to beyond where they should be. Any ideas?