lundi 7 septembre 2015

Copying files from one folder to another folder in s3 of same bucket NODE JS

I am trying to copy a file from one folder to another folder in same bucket, But I am gettnin Access denined error. But if I try to do it on two different buckets means its wokring fine.

Please find what I have tried so far below:

var AWS = require('aws-sdk');
AWS.config.update({
     accessKeyId: 'AKIAIUASGORST2DFWX5A',
     secretAccessKey: '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'
    });
var s3 = new AWS.S3();
var params = {
    Bucket : 'bucketname', /* Another bucket working fine */ 
    CopySource : 'bucketname/externall/1.txt', /* required */
    Key : "1.txt", /* required */
    ACL : 'public-read',
};
s3.copyObject(params, function(err, data) {
    if (err)
        console.log(err, err); // an error occurred
    else {
        console.log(data); // successful response
    }
});




Aucun commentaire:

Enregistrer un commentaire