Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Using workload Identity federation AWS ECS

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")

GoogleCredentials credentials = GoogleCredentials.fromStream(new ByteArrayInputStream(Base64.getDecoder().decode(base64EncodedGCPCredentials)));
Dns dns = DnsOptions.newBuilder()
.setCredentials(credentials)
.setProjectId(projectId)
.build()
.getService();

Any pointers on how to handle authentication using WIF with AWS ECS?

2 4 1,378