For a system I'm building, I have set up an AWS scheduled Fargate task through the python cdk. This task is started every hour and retrieves events from the past hour from some external endpoint to further process. This scheduled task works to satisfaction.
Now, I want to also be able to run this task on demand. This will be for initial loads where (much) more than one hour of event data is to be retrieved, or for corrective loads when the sheduled task has failed for any reason. These will probably not need to happen more than about once each two months.
Is there a way I can create a one-off task, preferably with altered environment variables, from my already-defined scheduled Fargate task? This one-off task should then be able to be started ad-hoc from the AWS dashboard.
As it stands, I can manually start a new one-off task from the task definition I created for the scheduled Fargate task. But this requires the user (which won't always be me) to specify all sorts of parameters like selecting the vpc, subnets, and environment variable overrides. I'd rather reuse those specified for the scheduled fargate tasks, or have them stored somewhere, so that these don't need be entered manually. Is this possible?
I feel my question is similar to this one, but the page linked to in that answer does not really tell me how to accomplish a one-off or "standalone" task through the cdk.
Unfortunately there's no way to do this. What you have discovered is all that is available. There's no way to run a "one-off" version of a scheduled task in the AWS dashboard. The only option would be to modify the schedule through the dashboard for it to start in the next few minutes, wait for it to start, and then modify the schedule again to whatever it was before.
You could automate this by creating a script using something like Python and the AWS SDK to query the scheduled task's details, and create a new one-off task via the ECS Run Task API. There is just no way to do that currently via the AWS dashboard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With