claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

Add destination bucket property to claudia add-s3-event-source #122

Closed ghost closed 7 years ago

ghost commented 7 years ago

I'd like to suggest adding a destination bucket property to Claudia's add-s3-event-source. This would set up the IAM to allow write access to the destination bucket specified. Currently, attempting to write to a different bucket than was read from will result in an Access Denied error.

Example: claudia add-s3-event-source --bucket mysrcbucket --dest mydestbucket or claudia add-s3-event-source --src mysrcbucket --dest mydestbucket


It should be possible to write to a different bucket than was read from.

The write fails. Logs show an Access Denied error message.

{\"errorMessage\":\"Access Denied\",\"errorType\":\"AccessDenied\",\"stackTrace\":[\"Request.extractError (/var/task/node_modules/aws-sdk/lib/services/s3.js:539:35)\",\"Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:105:20)\",\"Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:77:10)\",\"Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:678:14)\",\"Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)\",\"AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)\",\"/var/task/node_modules/aws-sdk/lib/state_machine.js:26:10\",\"Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)\",\"Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:680:12)\",\"Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:115:18)\"]}

The simplest example to demonstrate this error message is to change this one line in the official example to write to any other existing bucket name: https://github.com/claudiajs/example-projects/blob/master/s3-file-processing/convert.js#L19 The error message above will appear in the logs.

gojko commented 7 years ago

this is not a bug. for something like this, the best thing is to submit a pull request. please use github issues for bugs only