One-time Scheduled Events

Hello. I know that it is possible to schedule recurring events with Cloudwatch, i.e. rate(5 minutes), but I am writing a notification service and need to schedule one-time events, i.e.:

On December 12th, 2017 at 8:37 pm send a notification.

Can anyone point me in the right direction?

Thank you.

I was under the impression that when you add the ttl to dynamodb, the item is not actually deleted up until an hour later.

Sorry, can you elaborate on that a bit?

You should be able to use the CloudWatch Event API to schedule an event that triggers your Lambda at the correct time.

As @damianesteban mentioned, timing is not guaranteed. In our use case, we’ve actually seen items not be deleted for several days past their TTL. DynamoDB expiration is not meant to be used for precision timing.

See: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html where it says:

DynamoDB typically deletes expired items within 48 hours of expiration. The exact duration within which an item truly gets deleted after expiration is specific to the nature of the workload and the size of the table. Items that have expired and not been deleted will still show up in reads, queries, and scans.

1 Like

The way we currently solved this is by polling a DynamoDB table every 5 minutes. If DynamoDB TTL didn’t have that delay it would be fantastic because it would take care of both scheduling and removing the item in one shot.