node.js - NodeJS uploading Object to S3 using IAM Roles -
folks, trying nodejs upload s3 object. trying use iam roles instead of hard-coding creds. i've created bucket policies link instance launched via role, there should no issues....
code:
function uploadtos3 (callback) { var newfile = '/dev/shm/uploads/'+req.query.mid; var s3 = new aws.s3(); var params = { acl: 'public-read', bucket: 'foobucket', key: req.query.mid } s3.putobject(params, function (err, data) { if (err) { console.log(err, err.stack); callback(err); } else { callback(); } }) },
anything potentially missing?
user error, had incorrect arn in s3 bucket policy.
Comments
Post a Comment