ECS Task IAM Role for cross-account resource sharing.
I have a ECS task that needs to access resources in another aws account.
My ECS tasks are running in Account A and the resources that I need to access are in account B.
For this I have created a role in account B with necessary permission to the required resources and I have added a trust relationship with account A as well.
Now in account A where ECS is running I have added sts:AssumeRole to the Remote IAM role in account B.
This however is not working. My ECS task is still not being able to access resourcecs in account B.
How do i set up cross-account IAM roles/policies that work with ECS Task.
Posted Mar 31, 2020, 9:56 AM UTC
You mentioned you added sts:AssumeRole to the IAM role in account B. Did you state that right?
You should be adding AssumeRole to the IAM role in Account A that’s assigned to your ECS task.
Yes. that is correct.
Acc A runs the ecs service. So the IAM role in account A needs to assume a role that allows it to access some data from account B.