How would one go about setting up workload identity federation for AWS ECS (container service)?
IMDS url for EC2 instance - http://169.254.169.254/latest/meta-data/iam/security-credentials
URL for ECS - http://169.254.170.2/get-credentials
When I try to use the config file that's generated after setting up WIF as per Google docs, I see "Failed to retrieve AWS credentials" exception in my application running on AWS ECS.
I used java gcp sdk to retrieve google credentials -
String base64EncodedGCPCredentials = credentialsMap.get("base64EncodedGCPCredentials")
Any pointers on how to handle authentication using WIF with AWS ECS?
Hi @TridentChase.,
have you followed the GCP official documentation?
--> https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds
Hi @MaxImbrox ,
Yes I did. I see this 403 error when I try to use the service :
{
"error": {
"code": 403,
"message": "Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).",
"errors": [
{
"message": "Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "IAM_PERMISSION_DENIED",
"domain": "iam.googleapis.com",
"metadata": {
"permission": "iam.serviceAccounts.getAccessToken"
}
}
]
}
}
The service account being used does have iam.serviceAccounts.getAccessToken and I've double checked it.
Has anyone found a solution to this?
I am having the same problem
We used the below steps to fix the issue :
We noticed that for ecs, when getCallerIdentity is called, it returns career-ecs as the assumed role.
P.S we used service account impersonation