mercredi 24 juin 2015

Access Denied from nodejs amazon sdk to file posted to S3 using pre-signed url

I'm trying to do the following:

  1. generate a presigned-url so that any client may upload a file to S3, after requesting the url
  2. using the nodejs amazon sdk, download a file previously uploaded using setp 1.

In order to generate the signed url, I'm using this parameters:

{
  Bucket: BucketName, 
  Key: uri, 
  Expires: 60,
  ACL:'public-read',
  ContentType: ContentType,
  ContentLength: ContentLength
}

Then, using curl, POST the file to the url:

curl -v -T package.jar  presignedurl

This uploads the file (with the caveat that I have to enable public PutObject on the bucket), otherwise access is denied.

Later, when I try to download the previous file using nodejs sdk, I get Access Denied.

If I go to the file directly using its url with a browser, I'm able to download it.

Any help will be greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire