Open connorads opened 4 years ago
Would be nice if ...
1 minute CRON job? 1440 minutes a day ... scan, query for expiry time? Store the reply URL so that it can reply to channel on deletion. Do these links expire?
If a TTL can trigger a lambda, it's possible that a webhook event could be emitted to notify that a lock has expired. It is possible to trigger lambdas on DynamoDB changes, hopefully the TTL feature can be picked up by that. Though reading the article, it looks like more thought may need to be put into this approach.
Scan is a pretty expensive DynamoDB call. Depending on the size of your database, it can be a pretty read-intensive call.
The DynamoDB TTL could trigger a lambda according to this and this . The trouble is that it might not actually get deleted for up to 48 hours which is not very useful for Lockbot where a 1 minute error margin would probably be tolerable 😢
The scan could indeed get expensive! I'm not a DynamoDB expert but we might be able to make use of a secondary index on the expiry time so we could do queries on it. But indexes aren't free either. I believe they can reduce read costs but increase storage costs. Which might be a reasonable trade off in the case of a polling CRON job.
Hopefully there's a simple solution lurking somewhere 🧐
- Locks could be set to expire at a particular minute
We could use EventBridge.PutRule to acquire cron scheduled event per Resource
, so as soon as we add a resource we PutRule with defined cron, and it will run a lambda on a certain time and delete the Resource from dynamo. we do not need any new indexes, we do not have to scan because the rule can be configured with input, so we exactly know the key.
I suggest using the following interface: /lock dev 1h
so it could be h, m or d, or even pattern like 1h30m
indicating how much time it will last. or it could be exact time 9:00
- means 9 am
I would love to work on it with my pace
Hey @floydspace sounds like a great idea!
I've tried to keep the README.md and CONTRIBUTING.md up to date but it may not be entirely clear how to setup a local dev environment or deploy to a dev environment. If you find anything confusing please do ask me and feel free to update the docs.
If you'd like a walkthrough of the project or discuss anything then I'm be happy to jump on a call.
Join the Lockbot Slack Workspace if you'd like to chat.
- Locks could be set to expire at a particular minute
We could use EventBridge.PutRule to acquire cron scheduled event per
Resource
, so as soon as we add a resource we PutRule with defined cron, and it will run a lambda on a certain time and delete the Resource from dynamo. we do not need any new indexes, we do not have to scan because the rule can be configured with input, so we exactly know the key.I suggest using the following interface:
/lock dev 1h
so it could be h, m or d, or even pattern like1h30m
indicating how much time it will last. or it could be exact time9:00
- means 9 amI would love to work on it with my pace
Great solution, but I think there is a limit of 100 rules per account which means with a single aws account, lockbot can have at max 100 resources
This would be a good feature to have. Is there a plan to add it? We use the app and it is great but we do want a way to release locks automatically after certain default time.
Could use DynamoDB TTL but it has limited time guarantees and wouldn't notify users.