I am looking for the following workflow:

  • Add an entry to a table of my Postgres database with a end_date and state (with the following values: active or done) columns.
  • Execute a lambda at the exact end_date value to update the state of this specific entry from active to done

The only ressources I found on Google about how scheduling a lambda function was for repetitive execution but I'm looking for single execution at specific date and time.

Any suggestions?

  • Can you share what you found on Google? It may improve the answer to show how to make a minor change instead of creating a whole new example? – JeffO May 6 '16 at 15:50
  • How many entries in the database are we talking about? The right answer for 20 records won't be the right answer for 20,000 or 20 million. – Dan Pichelman May 6 '16 at 16:22
  • Also, how 'exact' do you need to be? Within a couple of hours? a couple of minutes? no more than 10 milliseconds from the end_date? – Dan Pichelman May 6 '16 at 16:23
  • 1
    @JeffO Here is what I found: alestic.com/2015/05/aws-lambda-recurring-schedule Clearly after few more readings, I think the correct approach is to execute a lambda recurrently and check if I need to switch the status from active to done on all the rows of the table that are marked as active – Jean Lbr May 8 '16 at 12:14
  • @DanPichelman We're talking about few hundreds (maybe few thousands in a couple of months) entries in the table and the exactitude span should be between minutes and hours. – Jean Lbr May 8 '16 at 12:18

You can schedule a lambda function to run as a crontab entry, and in the crontab entry set the exact date/time with no repetition.

|improve this answer|||||
  • 1
    How does this execute on the exact end date? Assuming there's more than one unique value across all records. – JeffO May 6 '16 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.