Description
Description
Attempting to utilize AWS Powershell Netcore tooling with EKS using IRSA credentials which supply the AWS_WEB_IDENTITY_TOKEN_FILE environment variable and file for getting credentials for a kubernetes pod. When making calls such as Use-STSCallerIdentity, the AWS cmdlets do not find the Web Identity Token information. Instead it is defaulting to the node's instance profile.
Reproduction Steps
Create a basic Ubuntu Docker Image with .NET 5 (latest) and Powershell Core downloaded.
Install AWSPowershell.NetCore version 4.1.15.0.
Setup EKS with the recommended IRSA configuration and assign this role to the deployment pod in question
Run Get-STSCallerIdentity
This will return the node's IAM role, not the Pods.
AWS CLI will return correctly:
{
"UserId": "AROAVHFETX5TATZNVXBVJ:botocore-session-1637098166",
"Account": "123456789",
"Arn": "arn:aws:sts::123456789:assumed-role/runner-service-account/botocore-session-1637098166"
}
Powershell call will return
{
"Account": "123456789",
"Arn": "arn:aws:sts::123456789:assumed-role/platform-2021102117024492730000000e/i-0c37ddbaf651488a1",
"UserId": "AROAVHFETX5TH76JTXAAB:i-0c37ddbaf651488a1",
"ResponseMetadata": {
"RequestId": "b445fa1c-342a-477a-a2fb-c23b0e9a53d5",
"Metadata": {}
},
"ContentLength": 493,
"HttpStatusCode": 200,
"LoggedAt": "2021-11-16T21:39:23.3531025+00:00"
}
Environment
- Build Version: 4.1.15.0
- OS Info: Ubuntu 20.04
- Build Environment: Download from nuget registry
- Targeted .NET Platform: 5
Resolution
- 👋 I can/would-like-to implement a fix for this problem myself
This is a 🐛 bug-report