I am unable to create bucket in AWS S3 server using aws-sdk. But I can add new folder and file in existing bucket but not able to create new. Below code, which I used to create a new bucket.
import AWS from "aws-sdk";
AWS.config.update({
region: config.region,
accessKeyId: config.accessKeyId,
secretAccessKey: config.secretAccessKey,
});
const s3 = AWS.S3();
s3.createBucket({ Bucket: "admin"}, (error, data) => {
if(error.statusCode === 409){
upload();
}
if (error) {
console.log(error)
} else {
console.log(data);
}
});