我試圖使用基本教程如下AWS node.js沒有創建S3存儲桶?
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./myawsconfig.json');
AWS.config.update({region: 'eu-west-1'});
var s3 = new AWS.S3();
s3.client.createBucket({Bucket: 'pBucket'}, function() {
var data = {Bucket: 'pBucket', Key: 'myKey', Body: 'Hello!'};
s3.client.putObject(data, function(err, data) {
if (err) {
console.log("Error uploading data: ", err);
} else {
console.log("Successfully uploaded data to myBucket/myKey");
}
});
});
創建一個S3桶,但我收到以下錯誤
node createbucket.js
Error uploading data: { [NoSuchBucket: The specified bucket does not exist]
message: 'The specified bucket does not exist',
code: 'NoSuchBucket',
name: 'NoSuchBucket',
statusCode: 404,
retryable: false }
您確定您的令牌正在驗證中,並且您的存儲桶名稱在整個S3中都是唯一的嗎? –
我只是將我的代碼中的存儲桶名稱更改爲絕對唯一的存儲桶名稱。我不確定我的令牌是否正在驗證,但假設我會收到一個錯誤,說如果是這種情況,那麼多嗎? –