I'm trying to setup a scheduled task with ECS Fargate but I cannot figure out why it is not running. I can confirm the task works correctly using RunTask
but when I try to trigger it on a schedule all I get is a bunch of 'FailedInvocations' with no explanation.
I do know though that the rule is being triggered so this is a good sign. See the screenshot below:
But everytime it is triggered there is just a 'FailedInvocation'. Here's the scheduling rule:
And the default permissions on the ecsEventRole
with just ecs:runTask
:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ecs:RunTask" ], "Resource": [ "*" ] } ] }
My hunch says that this ecsEventsRole
doesn't have enough permissions. Should I try to give it the ones that ecsTaskExecutionRole
has?
Thanks
EDIT: This is now supported in us-east-1
region. See comments.
Open the Amazon ECS console at https://console.aws.amazon.com/ecs/ . In the navigation pane, choose Task Definitions and select the task definition to run. To run the latest revision of a task definition, select the box to the left of the task definition to run.
To view your scheduled tasks (Amazon ECS console)Open the Amazon ECS console at https://console.aws.amazon.com/ecs/ . Choose the cluster your scheduled tasks are run in. On the Cluster: cluster-name page, choose the Scheduled Tasks tab. All of your scheduled tasks are listed.
Although it's been over an year, AWS still don't have a proper way to see invocation logs.
As you already know we can invoke tasks by RunTask
manually, so does Scheduled Task.
The only difference is that Scheduled Task is triggered by CloudWatch rules.
We can easily see invoke logs in CloudTrail Event history
, go there and filter events with Event name: RunTask
and select the time range you want to check, find the event and click View Event
, you'll see the error code and response.
I ran into a similar issue where regular ECS Scheduled Tasks were not running.
I finally resolved it by adding an additional policy to ecsEventsRole
which allows CloudWatch Events to pass IAM roles to ECS Tasks:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iam:ListInstanceProfiles", "iam:ListRoles", "iam:PassRole" ], "Resource": "*" } ] }
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