In order for your Lambda function to pass the role to RunTask, the function's execution role policy needs to allow both
iam:PassRole. The policy currently associated with the function does not allow these actions.
Note: The ECS Task Role does not need these permissions. The Task Role only needs those permissions necessary for the functioning of the application itself.
Thank you for clarifying that Lambda execution role has required proper permission to run ECS task and IAM PassRole. The trust relationship policy configuration also looks good, allowing ECS task to assume the role. Here is the general troubleshooting guideline to troubleshoot this issue:
For further troubleshooting, we will need to look into account specific details. Please reach out to AWS support to investigate the issue.
Is it possible to kill/stop a running lambda function?asked 6 years ago
How to have ECS map ports automatically when a task is deployed in EC2?
Is it possible to change the assignPublicIp setting of running ecs fargate to disable?asked 19 days ago
ECS Task is not using the role attached to it?Accepted Answerasked a month ago
Unable to override taskRoleArn when running ECS task from Lambdaasked 4 months ago
ecs service was unable to place a task because your account is currently blockedasked 5 months ago
How to convince EventBridge to pass S3 event information to an ecs target?Accepted AnswerMODERATORasked 2 years ago
Unable to use X-Http-Method-Override header with Lambda Function URLasked 3 months ago
Lambda function cannot run ECS task: unable to retrieve ecr registry authasked 3 months ago
defining the name of task definition json to run ecs task in github actions