I want to delete AWS S3 Object according to the time of creation using Nodejs Lambda function. I want to delete all objects in a particular folder which are created before 24 hour
Now I have tried to delete multiple object which is success but I dnt know how to do it with time
var params = {
Bucket: s3bucket,
Delete: {
Objects: [
{
Key: 'scheduled_lambda_test/1.png'
},
{
Key: 'scheduled_lambda_test/2.png'
}
]
}
};
s3.deleteObjects(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});