awslabs / fargatecli

CLI for AWS Fargate
Apache License 2.0
894 stars 115 forks source link

EntityAlreadyExists error when creating a service #87

Open gmcguire opened 5 years ago

gmcguire commented 5 years ago

When creating a service in an empty cluster, I'm seeing the following error:

EntityAlreadyExists: Role with name ecsTaskExecutionRole already exists.
    status code: 409, request id: 6eb085be-77e1-11e9-a00c-09daa6044045

It looks like for whatever reason the GetRole call in CreateEcsTaskExecutionRole isn't finding the existing role, and tries to recreate it.

https://github.com/jpignata/fargate/blob/master/iam/role.go#L28

If I delete the role, this code recreates it correctly, but the next service I try to add hits the same error.

joshenders commented 3 years ago

Also experiencing this issue. It seems to happen for me when fargate task run fails before launching a container. You can repro this by running fargate with a new IAM user with enough IAM policy grants to create the ecsTaskExecutionRole but nothing else.