I would like to know how to copy the object from s3 to s3 using node.js With the aws s3 command, It could be executed as follows.
s3 cp --recursive s3://xx/yy s
If you want to really move (so not just copy, but in addition remove the source file)
const moveAndDeleteFile = async (file,inputfolder,targetfolder) => {
const s3 = new AWS.S3();
const copyparams = {
Bucket : bucketname,
CopySource : bucketname + "/" + inputfolder + "/" + file,
Key : targetfolder + "/" + file
};
await s3.copyObject(copyparams).promise();
const deleteparams = {
Bucket : bucketname,
Key : inputfolder + "/" + file
};
await s3.deleteObject(deleteparams).promise();
....
}