UPDATE: got it working from the commandline after add a full access policy permissions to that user. Now when I do it with Node there is no error but I can't see the files in my s3 file manager.
I keep getting an EPIPE error using Amazon's S3 service.
I am a little stuck and unsure of how to proceed.
I am using Node.js with the Knox module.
Here is my code:
var client = knox.createClient({
key: amazonAccessKeyId,
secret: amazonSecretAccessKey,
bucket: amazonBucketName
});
function moveFiles() {
moveUploadedFile(req.files['aps-file'].path,'/aps-products.csv', this.parallel());
moveUploadedFile(req.files['perry-craft-roof-file'].path,'/perry-craft-roof-products.csv', this.parallel());
res.end('successful!');
}
function moveUploadedFile(srcPath, dstPath, callback) {
client.putFile(srcPath, dstPath, { 'x-amz-acl': 'public' }, function (err) {
if (err) {
callback(new Error("Error uploading file for " + dstPath + ": " + err.message), srcPath);
console.log(err);
return;
}
console.log('Finished writing file ' + dstPath + ' to Amazon S3 Cloud');
callback(null, srcPath);
});
}
Ok so these are the steps I took to resolve this problem:
aws put /file/to/put /new-file
.{'x-amz-acl': 'public' }
it should be 'public-read'
otherwise it will not add the files to s3 (without errors). Note that {'x-amz-acl': 'private' }
works too.