-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable WebIdentityTokenCredentialsProvider to use custom STS endpoint #2343
Comments
While we're waiting on this, here's a workaround for EKS to get sts.amazonaws.com resolved to a local address:
|
Marking as a feature request. |
This looks like it might be working. On a hunch I tried setting the |
Following the suggestion from @gillius , I couldn't get |
Hi @joelthompson, how did you solve this question? I'm with the same scenario here. |
Setting |
We don't have plans to support this in v1 before going into Maintenance Mode. A workaround is described in the above comment from @joelthompson. Java SDK v2 already supports custom STS clients in the StsWebIdentityTokenFileCredentialsProvider, so try the Java SDK v2 out and let us know if you have questions by creating an issue in the v2 repo. Reference:
|
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the Feature
When using the
WebIdentityTokenCredentialsProvider
I would like to control which STS endpoint thests:AssumeRoleWithWebIdentity
call uses. Currently, it always uses the global STS endpoint.Is your Feature Request related to a problem?
We want to use IAM Roles for Service Accounts for our Kubernetes pods to get AWS credentials, but we don't want our pods to have access to the public internet. Instead, we want our pods to make the
sts:AssumeRoleWithWebIdentity
call over regional STS VPC endpoints (which have policies on them!). This isn't possible without configuring the SDK to use the regional STS VPCEs and then forcing DNS resolution for the regional STS endpoint to go to the VPCE hostname (e.g., with private DNS enabled).The reason is because
WebIdentityTokenCredentialsProvider
, under the hood, just uses a largely defaultAWSSecurityTokenServiceClientBuilder
to construct an STS client, without any endpoint specification:aws-sdk-java/aws-java-sdk-sts/src/main/java/com/amazonaws/auth/STSAssumeRoleWithWebIdentitySessionCredentialsProvider.java
Lines 122 to 125 in 772b07b
Proposed Solution
A few different options would help:
STSAssumeRoleWithWebIdentitySessionCredentialsProvider
to read a new environment variable, e.g.,AWS_STS_DEFAULT_ENDPOINT
, and, if set, configure the STS client to use that as the endpoint. Then, we can just configure our pods with our STS VPCE hostname in that environment variable.WebIdentityTokenCredentialsProvider
to provide an option to configure the STS endpoint to use. This is less attractive as it requires code changes in clients, and while we can change our own code, we won't be able to configure any third-party products/tools to use this.Describe alternatives you've considered
Set the
AWS_STS_REGIONAL_ENDPOINTS
environment variable toregional
on our pods and either turn on private DNS for our VPCE or use something like CoreDNS's rewrite option to rewrite the DNS request to our VPCE DNS name. The downside here is that we can only have a single VPCE, with a single policy, when in some cases we might want different workloads to use different VPCEs with different policies.Additional Context
Your Environment
We're running on EKS.
The text was updated successfully, but these errors were encountered: