javascript - S3 Access Denied -
since yesterday, i've been getting access denied error when i'm trying upload file 1 of s3 buckets.
javascript code:
var pass = new stream.passthrough(); var contenttype = (input.filename.endswith('.html') ? 'text/html' : 'text/javascript'); var params = { bucket: 'bucket_name', key: input.filename, body: pass, acl: 'public-read', contenttype: contenttype }; s3.upload(params, function(err, data) { if (err) { console.error('error while uploading file: ' + err + '. uploading file ' + params.key + ' bucket ' + params.bucket + '.'); throw err } }); return pass;
my initial thought because of iam policies, although hadn't changed , worked previously.
iam policy:
{ "action": [ "s3:putobject", "s3:pubobjectacl" ], "resource": [ "arn:aws:s3:::bucket_name/*" ], "effect": "allow" }
i've been staring @ past few hours, can't see problem is. according this link, should correct way configure policies. , yesterday worked fine.
edit> tried "action" : "*" , same result.
this embarrassing ...
didn't read policy properly, pubobjectacl not correct name, putobjectacl is.
Comments
Post a Comment