Create new bucket in Clever-Cloud Cellar (S3)

To use aws-sdk to create a new bucket in Clever-Cloud Cellar, you must set LocationConstraint to the empty string "".

Otherwise the operation will fail with InvalidLocationConstraint.

Full example (using Node.js) follows, replace with your values.

const AWS = require('aws-sdk');

AWS.config.update({accessKeyId: '…', secretAccessKey: '…'});
const endpoint = new AWS.Endpoint('cellar-c2.services.clever-cloud.com');

const s3 = new AWS.S3({ endpoint, signatureVersion: 'v4' });

var params = {
  Bucket: '…', /* bucket name, required */
  CreateBucketConfiguration: {
    LocationConstraint: ''
  },
};
s3.createBucket(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
  s3.listBuckets(function(err, res) {
    console.log(err,res);
  });
});