4 ms·
The best use case of Lambda for us is Scheduled tasks and stupid administrative tasks that you would not like to put it in your /etc/crontab
by CSDude 9y ago
The best use case of Lambda for us is Scheduled tasks and stupid administrative tasks that you would not like to put it in your /etc/crontab
- mulmen 9y agoThis feels like an anti pattern. Lambda is event driven, it doesn’t even have a mechanism to schedule activity. You have to abuse some other service to create an event on a schedule. Surely this is not the best use of the service, even if it is common. If you need to run tasks on a schedule what’s wrong with cron? Or a cron service?
- nitely 9y agoThere is an AWS cron service, it actually runs on top of lambdas[0]. If your definition of "abuse" is triggering an event with cloudWatch, then every service must be "abused" (SNS, S3, dynamodb, etc) as well. [0]: https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html https://docs.aws.amazon.com/lambda/latest/dg/tutorial-schedu...
- mulmen 9y agoMaybe I am hung up on the name but Cloudwatch is a monitoring service. It doesn't seem obvious to me why this is the source of scheduled events.
- niteshade 9y agoCloudWatch monitors logs for specific keywords, if it finds a certain number of them within a time threshold it creates an "Alarm" which then triggers a Lambda.
- mulmen 9y agoYeah and that feels like a hack to me. What generates the events on the right cadence to trigger this Lambda alarm? Why not just have that run the Lambda? And why not just have that run the code like cron? I know it works and it fills a gap for people but it just feels odd to me. It's like there is cron -> log -> monitor -> alarm -> event -> lambda -> script when you could just have cron -> script. I'm probably just hung up on the naming and the fact that these events are branded as part of Cloudwatch. If there was some service spun off that just generated events in AWS I wouldn't raise an eyebrow, even if under the hood it was exactly the same thing.
- munns 9y agoCloudWatch actually has a few parts: CloudWatch Metrics, Logs, and Events. It's the scheduled component of Events that allows you to do this.
- munns 9y agoYou can schedule Lambda function invocations via CloudWatch Events: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/RunLambdaSchedule.html https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/R.... It can help you replace cron running yourself pretty easily. It even uses cron syntax for the scheduling.