Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
Delete AWS S3 Object using Nodejs Lambda function

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
});
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use node sdk and perform below operations

  1. use listObject action on your folder.

  2. Loop through all the object returned for that folder and check last modified date.

  3. If object is expired add object key to an array.

  4. Delete all the object in expired array

Node SDK Doc - http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!