问题描述:
客户那里poc,填写aws的AK(access key) SK(secret key)之后,链接不上到aws中国区。报这个错,很显然是网络问题,检查发现是服务器DNS没有设置,无法解析。
链接不上aws还可能的情况是,服务器时间或者时区不对,也是可能连不上的。
解决方案:
public static AWSProxySetting getProxySetting() {
try {
AWSProxySetting proxySetting = new AWSProxySetting();
String host = getProperties("plugin.aws.proxy.host");
if(host != null && host.trim().length() > 0) {
proxySetting.setHost(host.trim());
}else {
return null;
}
String portStr = getProperties("plugin.aws.proxy.port");
if(portStr != null && portStr.trim().length() > 0) {
int port = Integer.parseInt(portStr);
proxySetting.setPort(port);
}else {
log.info("未设置AWS代理端口!");
return null;
}
String userName = getProperties("plugin.aws.proxy.username");
if(userName != null && userName.trim().length() > 0) {
proxySetting.setUserName(userName.trim());
}
String password = getProperties("plugin.aws.proxy.password");
if(password != null && password.trim().length() > 0) {
proxySetting.setPassword(password.trim());
}
return proxySetting;
} catch (NumberFormatException e) {
log.info("AWS代理端口设置错误!");
return null;
}
}