How do I manage cross account access with IAM Roles for Service Accounts? #156
-
I'm looking at how to provide access to an S3 bucket in our In particular, I have an EKS pod in my prod account which needs access to an S3 bucket in the prod account, and a second S3 bucket in the shared account. I have a role in prod which is setup for IRSA and provides access to a S3 bucket in the prod account, how can I write the IAM policies in the shared account to preform a cross account s3 bucket access, via role chaining, in Terraform without manually copying ARNs and OIDC identifiers around? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The best way to address this is to allow direct access to the bucket to the prod account IAM role, using S3 bucket policies (https://aws.amazon.com/premiumsupport/knowledge-center/cross-account-access-s3/). With that said, unfortunately, you won’t be able to get away from manually copying ARNs around, primarily because cross account output access in |
Beta Was this translation helpful? Give feedback.
The best way to address this is to allow direct access to the bucket to the prod account IAM role, using S3 bucket policies (https://aws.amazon.com/premiumsupport/knowledge-center/cross-account-access-s3/).
With that said, unfortunately, you won’t be able to get away from manually copying ARNs around, primarily because cross account output access in
terragrunt
is fairly tricky to implement cleanly. The best way to make this work is to make the IAM role name coded in a common data file that you import and pass to each account. Once you have that, you should be able to compute the IAM role arn used by the pod, since the IAM role arn is of the formarn:aws:iam:<ACCOUNT_ID>::role/<NAME>
, where…