com.amazonaws.sdkclientexception:无法在getsessiontoken中执行http请求:sts.amazonaws.com

2uluyalo  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(345)

没有找到确切的根本原因。这是在执行时发生的 GetSessionToken 以及不一致的行为。有人知道根本原因和可能的解决办法吗?
aws java sdk版本1.11.905
执行的代码

AWSCredentials awsCredentials = new BasicAWSCredentials(accessKeyId, accessKeySecret);
AWSSecurityTokenService stsClient = AWSSecurityTokenServiceClientBuilder
                                    .standard()
                                    .withRegion("us-west-2") 
                                    .withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
                                    .build();
// Start a new session for managing a service instance's bucket 
GetSessionTokenRequest getSessionTokenRequest = new GetSessionTokenRequest().withDurationSeconds(43200);
// Get the session token for the service instance's bucket 
// Error initiated from here 
sessionCredentials = stsClient.getSessionToken(getSessionTokenRequest).getCredentials();

错误:

com.amazonaws.SdkClientException : Unable to execute HTTP request: sts.amazonaws.com
com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1207)
com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1153)
com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:802)
com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:770)
com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:744)
com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:704)
com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:686)
com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:550)
com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:530)
com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient.doInvoke(AWSSecurityTokenServiceClient.java:1652)
com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient.invoke(AWSSecurityTokenServiceClient.java:1619)
com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient.invoke(AWSSecurityTokenServiceClient.java:1608)
com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient.executeGetSessionToken(AWSSecurityTokenServiceClient.java:1546)
com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient.getSessionToken(AWSSecurityTokenServiceClient.java:1516)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题