AWS JAVA SDK CLI:java.net.SocketTimeoutException

AWS JAVA SDK CLI : java.net.SocketTimeoutException

我正在拨打 API 电话,我正在尝试通过 sts assume-role API.

我的 Java 程序是:

STSAssumeRoleSessionCredentialsProvider  = new STSAssumeRoleSessionCredentialsProvider(credentials,"arn:aws:iam::093937234853:role/CapOne-CrossAccount-CustomRole-ReadOnly","123");
ec2Client.setRegion(getRegion());
this.setDescribeInstancesResult(ec2Client.describeInstances());

在上面的凭据变量中,我传递了我的秘密 ID 和密钥。 我得到的错误是:

Sep 23, 2015 3:25:48 PM com.amazonaws.http.AmazonHttpClient executeHelper
INFO: Unable to execute HTTP request: connect timed out
java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

在我使用 STSAssume 角色之前,它工作正常。但是由于要求,我必须使用角色。所以我确定,我的凭据变量设置正确。

我没有正确设置我的代理参数,设置之后,它开始工作了:

ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setProxyHost("proxy.kdc.capitalone.com");
    clientConfiguration.setProxyPort(8099);
    clientConfiguration.setProxyUsername("EID");
    clientConfiguration.setProxyPassword("PWD");
    clientConfiguration.setPreemptiveBasicProxyAuth(false);