createBucket.js
511 Bytes
const AWS = require('aws-sdk');
const ID = 'id';
const SECRET = 'secret';
const BUCKET_NAME = 'dogpicture-dizzi';
const s3 = new AWS.S3 ({
accessKeyId: ID,
secretAccessKey:SECRET
});
const params = {
Bucket: BUCKET_NAME,
CreateBucketConfiguration: {
//Set your regieon here
LocationConstraint : "us-east-1"
}
};
s3.createBucket(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log('Bucket Created Successfully', data.Location);
});