我正在使用AWS Java SDK 1.11.257。 我正在尝试使用
获取我的AWS账户的所有区域的列表ec2Client.describeRegions().getRegions()
但这会导致异常,
Caused by: com.amazonaws.SdkClientException: Unable to execute HTTP request: ec2.us-west-2.amazonaws.com
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleRetryableException(AmazonHttpClient.java:1114) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1064) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.doInvoke(AmazonEC2Client.java:15654) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:15630) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.executeDescribeRegions(AmazonEC2Client.java:8320) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.describeRegions(AmazonEC2Client.java:8296) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.describeRegions(AmazonEC2Client.java:8332) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.vmturbo.mediation.aws.queryengine.AwsRegionQueryEngine.createDataCenters(AwsRegionQueryEngine.java:51) ~[com.vmturbo.mediation.aws-6.1.3.jar:?]
... 12 more
Caused by: java.net.UnknownHostException: ec2.us-west-2.amazonaws.com
at java.net.InetAddress.getAllByName0(InetAddress.java:1280) ~[?:1.8.0_161]
at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[?:1.8.0_161]
at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[?:1.8.0_161]
at com.amazonaws.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:27) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.DelegatingDnsResolver.resolve(DelegatingDnsResolver.java:38) ~[aws-java-sdk-core-1.11.257.jar:?]
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:112) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359) ~[httpclient-4.5.3.jar:4.5.3]
at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_161]
at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.conn.$Proxy147.connect(Unknown Source) ~[?:?]
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[httpclient-4.5.3.jar:4.5.3]
at com.amazonaws.http.apache.client.impl.SdkHttpClient.execute(SdkHttpClient.java:72) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1236) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1056) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513) ~[aws-java-sdk-core-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.doInvoke(AmazonEC2Client.java:15654) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:15630) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.executeDescribeRegions(AmazonEC2Client.java:8320) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.describeRegions(AmazonEC2Client.java:8296) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.amazonaws.services.ec2.AmazonEC2Client.describeRegions(AmazonEC2Client.java:8332) ~[aws-java-sdk-ec2-1.11.257.jar:?]
at com.vmturbo.mediation.aws.queryengine.AwsRegionQueryEngine.createDataCenters(AwsRegionQueryEngine.java:51) ~[com.vmturbo.mediation.aws-6.1.3.jar:?]
... 12 more
我猜这是网络问题。但是验证工作正常。所以我想知道为什么这个API会失败。任何帮助将不胜感激。