0

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 REST.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" -

aayani
  • 333
  • 9
  • 19
  • provide more info – kaxi1993 May 30 '17 at 10:57
  • I'm using multi-part request to post data to controller. The controller in turns make use of the Multer-S3 (https://www.npmjs.com/package/multer-s3) to post that file on to my S3 bucket. Now the catch is that it's working fine on the localhost instance, but I'm getting an access-denied error when it's deployed onto the AWS EB. – aayani May 30 '17 at 11:01
  • @user_47 you have to attach IAM role for an EC2 instance. IAM role with permission to access S3 – Kumaresh Babu N S May 31 '17 at 04:27

1 Answers1

0

I've never hosted with AWS but for Heroku it would mean that you simply have to provide login credencials in your CLI before pushing.

Jakub Pawlowski
  • 248
  • 1
  • 3
  • 8
  • There's a S3 bucket configuration file in my code. All my credentials are saved there. Please note that it's working fine as a localhost instance. But the problem is on the EB instance. – aayani May 30 '17 at 11:03