samedi 5 septembre 2015

s3 javascript create bucket

I have cognitoIdentityPool code for my credentials and use amazon aws javascript in browser. I can do everything with javascript in browser except createBucket. My js code in html is look like;

var s3 = new AWS.S3();
var params = {
  Bucket: 'myuniquebucketname', 
  ACL: 'private',
  CreateBucketConfiguration: {
    LocationConstraint: 'us-east-1'
  },
  GrantFullControl: 'STRING_VALUE',
  GrantRead: 'STRING_VALUE',
  GrantReadACP: 'STRING_VALUE',
  GrantWrite: 'STRING_VALUE',
  GrantWriteACP: 'STRING_VALUE'
};
s3.createBucket(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

First of all, if I give full control, what can I write for STRING_VALUE inGrantFullControl: 'STRING_VALUE', By the way, its not necessary to set up GrantRead, GrantWrite or other grant lines for working script. It gives cross origin CORS error. However I can delete bucket, upload file to buckets etc. clearly without CORS error. Any idea please.




Aucun commentaire:

Enregistrer un commentaire