3 ms·
You almost certainly wouldn't use lambda for that (the last option I've listed is a case where you still could). You have several options. For many cases like
by mej10 10y ago
You almost certainly wouldn't use lambda for that (the last option I've listed is a case where you still could).
You have several options.
For many cases like that you should just have an EC2 instance that you run jobs on -- this is the simplest and there are already many tools for managing scheduled tasks like that.
You could also use a scheduled Lambda to start an EC2 instance/record task info in a DynamoDB table and another Lambda to check the status of the task periodically, shutting the instance down when it is done and updating the status. I've written a thing that does this and it works pretty well. You can also use spot instances for this to potentially save some $.
You can use ECS and kick off an ECS Task via a scheduled Lambda. This means learning some stuff about ECS and Docker.
Another interesting but much more complex (and probably not applicable) option is to break your task up into chunks that take less than 5 minutes, and just have Lambdas kick off more Lambdas for the next parts of the task.
- gravypod 10y agoI think the appeal for Lambda for me is that I'm not a dev-ops guy. I just want to write some code and have it work. Sadly I don't think this will happen any time soon but I'd like a Lambda-like system that can be triggered from other AWS things.
- mej10 10y agoI am slightly disheartened that you would consider running something on a linux machine with cron "devops" ;). You can also have Lambdas execute commands on EC2 instances. This makes it easier to run non-web-app code in response to various AWS events since most things can be hooked into Lambda. Maybe that is more along the lines of what you want?