[ECS] [BUG]: Create Service Fails Using Multiple TG and Role Specified
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
Specifying the Role when creating a service with 2 target groups fails:
$ aws ecs create-service --cluster test --service-name test --task-definition nginx:1 --load-balancers '[{ "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/test1/8717e8583778e6c1", "containerName":"nginx", "containerPort": 80 }, { "targetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/test2/f003525972e6665a", "containerName": "nginx", "containerPort":80 } ]' --desired-count 1 --role ECS
An error occurred (InvalidParameterException) when calling the CreateService operation: You cannot specify an IAM role for services that require a service linked role.
Tested this with both the CLI and with CloudFormation as described in the docs https://aws.amazon.com/about-aws/whats-new/2019/07/amazon-ecs-services-now-support-multiple-load-balancer-target-groups/.
When the second target group is removed, it works as expected and the service is created successfully.
Why is it that the role is not recognized as a service linked role?
Contributor guide
Assessment
This issue has not been assessed yet.