AmazonEC2Client ec2Client = AWSEC2Client.getAWSEC2Client(set basicCredentials :: accesskey and secreate key);
ec2Client.setRegion(set regions);
final ClientConfiguration clientConfiguration = new ClientConfiguration()
.withConnectionTimeout(150000).withMaxConnections(200)
.withRetryPolicy(new RetryPolicy(null, null, 3, true));
在调用ec2Client.describeNetworkAcls();
时遇到以下异常:
org.apache.http.NoHttpResponseException: ec2.cn-north-1.amazonaws.com.cn未能回复 org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260) 〜[httpcore-4.3.3.jar:4.3.3] at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283) 〜[httpcore-4.3.3.jar:4.3.3] at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:197) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271) 〜[httpcore-4.3.3.jar:4.3.3] at com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:82) 〜[aws-java-sdk-core-1.10.54.jar:na] at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123) 〜[httpcore-4.3.3.jar:4.3.3] at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:685) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:487) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) 〜[httpclient-4.3.6.jar:4.3.6] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) 〜[httpclient-4.3.6.jar:4.3.6] at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:860) [aws-java-sdk-core-1.10.54.jar:na] at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:631) [aws-java-sdk-core-1.10.54.jar:na] at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:400) [aws-java-sdk-core-1.10.54.jar:na] at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:362) [aws-java-sdk-core-1.10.54.jar:na] at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:311) [aws-java-sdk-core-1.10.54.jar:na] at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:11095) [aws-java-sdk-ec2-1.10.54.jar:na] at com.amazonaws.services.ec2.AmazonEC2Client.describeNetworkAcls(AmazonEC2Client.java:5644) [aws-java-sdk-ec2-1.10.54.jar:na] at com.amazonaws.services.ec2.AmazonEC2Client.describeNetworkAcls(AmazonEC2Client.java:5656) [AWS-java的SDK-ec2-1.10.54.jar:NA]
请指导我是AWS新手
提前致谢!
答案 0 :(得分:1)
Beijing Region需要单独的凭据 - 未与其他地区相关联。
希望使用新北京地区的客户必须签名 中国独有的一套独立账户凭证 (北京)地区。拥有现有AWS凭证的客户不会 能够访问新区域中的资源,反之亦然。