amazon web services - AWS node.js SDK getting 'Access Denied' using AWS example -
i'm new @ aws, maybe i'm missing obvious required.
i have 2 version of code, different passing bucket 4 chars string vs 5 chars. getting different response aws. why that?
var aws = require('aws-sdk'); var s3 = new aws.s3(); s3.createbucket({bucket: 'node4'}, function() { var params = {bucket: 'node4', key: 'mykey', body: 'hello!'}; s3.putobject(params, function(err, data) { if (err) console.log(err) else console.log("successfully uploaded data mybucket/mykey"); }); });
running app.js:
➜ aws node app.js { [allaccessdisabled: access object has been disabled] message: 'all access object has been disabled', code: 'allaccessdisabled', region: null, time: fri feb 05 2016 20:45:11 gmt+0200 (ist), requestid: 'somerequestid', extendedrequestid: 'someextendedrequestid', statuscode: 403, retryable: false, retrydelay: 30 }
second code:
var aws = require('aws-sdk'); var s3 = new aws.s3(); s3.createbucket({bucket: 'node4e'}, function() { var params = {bucket: 'node4e', key: 'mykey', body: 'hello!'}; s3.putobject(params, function(err, data) { if (err) console.log(err) else console.log("successfully uploaded data mybucket/mykey"); }); });
running app.js:
➜ aws node app.js uploaded data mybucket/mykey
the different passing bucket 4 chars string vs 5 chars
actually difference don't have write access bucket named 'node4' , have access bucket named 'node4e'. did check see if both buckets created successfully? notice aren't checking errors in createbucket()
call, putobject()
call.
those generic bucket names using, wouldn't surprised if 1 failing, 'node4', in use aws account.
Comments
Post a Comment