我有一个在 EKS 中运行的应用程序实例,并设置了以下变量:
declare -x AWS_DEFAULT_REGION="us-west-2"
declare -x AWS_REGION="us-west-2"
declare -x AWS_ROLE_ARN="xxxxx"
declare -x AWS_WEB_IDENTITY_TOKEN_FILE="/var/run/secrets/eks.amazonaws.com/serviceaccount/token"
据我了解,有一个默认的 Java SDK 授权链,其中包含com.amazonaws.auth.WebIdentityTokenCredentialsProvider
在后台构建com.amazonaws.services.securitytoken.AWSSecurityTokenService
的内容。
但我无法意识到这种循环依赖是如何解决的?我的意思是您需要在创建过程中指定凭据,AWSSecurityTokenService
但凭据会创建服务本身。
我有这样做的实际要求,我想在 sts 客户端中自定义端点,但由于循环依赖而不能。
AWSSecurityTokenServiceClientBuilder.standard()
.withCredentials(new STSAssumeRoleWithWebIdentitySessionCredentialsProvider.Builder(
"arn",
"session",
"tokenfile")
.withStsClient(xxxx)
.build())
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://localhost:4566", null))
.build()