Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create new S3 bucket in AWS using nodejs?

How to create a new S3 bucket in AWS using nodejs?

I need to upload a large number of the image file on the s3 bucket for ease of using and manage the storage space on the cloud instead of my local server storage.

  • I am working on IoT project which captures the number of images once motion detects any object in their range. So send me the step to follow the configuration of AWS s3 Bucket integration using nodejs.
like image 585
Mac Avatar asked Sep 04 '25 02:09

Mac


1 Answers

Try this

 var params = {
   Bucket: "examplebucket", 
   CreateBucketConfiguration: {
   LocationConstraint: "eu-west-1"
  }
};
s3.createBucket(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response      
});

For more info read this link

like image 196
Sachin Shah Avatar answered Sep 07 '25 08:09

Sachin Shah