简体   繁体   中英

S3 copyObject sends Access Denied

I know this question has been asked earlier but it's solution is not working for me.

Amazon S3 copyObject is sending me Access Denied error. Object is an image and it's successfully copying the image in S3.

IAM user has been given all S3 rights.
In copyObject, I'm setting the bucket name as well like this:

exports.copyObjS3 = (filename, key) => {
  return s3
    .copyObject({
      Bucket: S3BUCKET,
      CopySource: encodeURI(`${S3BUCKET}/${filename}`),
      Key: key,
    })
    .promise();
};

S3BUCKET specifies name of the S3 bucket.

Can anybody explain me what can be the issue?

Thanks

Okay. So I had it done by adding ACL option.

exports.copyObjS3 = (filename, key) => {
  return s3
    .copyObject({
      Bucket: S3BUCKET,
      CopySource: encodeURI(`${S3BUCKET}/${filename}`),
      Key: key,
      ACL: 'public-read'
    })
    .promise();
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM