This part of cloudformation template creates the event, but do not actually execute it.
MyCWEventRule:
Type: AWS::Events::Rule
Properties:
Name: my-batch-event-rule
ScheduleExpression: cron(01 07 ? * * *)
State: ENABLED
Targets:
- Id: my-batch-job
Arn: !Ref Queue
BatchParameters:
JobDefinition: !Ref StartJob
JobName: tds-job
RoleArn: !Join [ "", [!Sub "arn:aws:iam::${AWS::AccountId}:role/service-role/", !Ref ruleIAMRole]]
There are no logs to check what the problem is. If I submit the job myself using console, it works as expected. The Job Definition parameter mentioned in cron is correct as seen in this image...
How do I troubleshoot failed cloudwatch events?
Update:
When I click on Edit and use "Create a new role for this specific resource" it works. It means there is some problem with the line...
RoleArn: !Join [ "", [!Sub "arn:aws:iam::${AWS::AccountId}:role/service-role/", !Ref ruleIAMRole]]
You guessed it right! There is no need of "service-role" in the ARN role path. It should look like this...
Or even better: