简体   繁体   中英

Access denied while uploading image to AWS S3

Objective: I have my Node.js app deployed as an Elastic Beanstalk instance on the AWS. I've to upload an image onto AWS S3.

Problem: It's giving me 'Access Denied' when I do so. Although it works perfectly okay when I do it locally (before pushing it onto AWS).

Note: I'm using Multer-S3 for this purpose.

What seems to be the problem? I've tried various S3 bucket policies, but to no avail.

PS: Here's the log for a request: 30986b8231ee88e94199988794871d76dedcf298fe4f11e435c164b13ae4e977 my-uploads [30/May/2017:10:31:07 +0000] 10.208.27.159 3272ee65a908a7677109fedda345db8d9554ba26398b2ca10581de88777e2b61 BC2B9DF9B31BB9F2 REST.PUT.OBJECT request-log2017-05-30-10-31-07-832319F788D6048E "PUT /my-uploads/request-log2017-05-30-10-31-07-832319F788D6048E HTTP/1.1" 200 - - 3912 48 21 "-" "aws-internal/3" - 30986b8231ee88e94199988794871d76dedcf298fe4f11e435c164b13ae4e977 my-uploads [30/May/2017:10:33:16 +0000] 10.170.228.198 3272ee65a908a7677109fedda345db8d9554ba26398b2ca10581de88777e2b61 4AAE9032DC461DDC REST.PUT.OBJECT request-log2017-05-30-10-33-16-88B9C33D271F6A96 "PUT /my-uploads/request-log2017-05-30-10-33-16-88B9C33D271F6A96 HTTP/1.1" 200 - - 347 60 8 "-" "aws-internal/3" - 30986b8231ee88e94199988794871d76dedcf298fe4f11e435c164b13ae4e977 my-uploads [30/May/2017:10:34:28 +0000] 10.237.175.206 3272ee65a908a7677109fedda345db8d9554ba26398b2ca10581de88777e2b61 0B0D3939958BB069 R EST.PUT.OBJECT request-log2017-05-30-10-34-28-2C6EAF903C627BD9 "PUT /my-uploads/request-log2017-05-30-10-34-28-2C6EAF903C627BD9 HTTP/1.1" 200 - - 357 33 8 "-" "aws-internal/3" -

我从来没有托管过AWS,但是对于Heroku来说,这意味着您只需要在CLI中提供登录凭据即可,然后再进行推送。

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