AWS Lambda,如何正确实例化AmazonHttpClient?

时间:2017-11-03 16:35:38

标签: java amazon-web-services aws-lambda

Node.JS lambda实现中似乎非常容易的事情:

var https = require("https");

在Java lambda中不起作用:

AmazonHttpClient httpClient = AmazonHttpClient.builder().build();

给了我一个例外:

  

java.lang.IllegalArgumentException:客户端配置不能   null at   com.amazonaws.util.ValidationUtils.assertNotNull(ValidationUtils.java:37)   在   com.amazonaws.http.settings.HttpClientSettings。(HttpClientSettings.java:44)   在   com.amazonaws.http.settings.HttpClientSettings.adapt(HttpClientSettings.java:52)   在   com.amazonaws.http.AmazonHttpClient。(AmazonHttpClient.java:314)   在   com.amazonaws.http.AmazonHttpClient。(AmazonHttpClient.java:131)   在   com.amazonaws.http.AmazonHttpClient $ Builder.build(AmazonHttpClient.java:396)

为什么呢?如何正确配置?

1 个答案:

答案 0 :(得分:2)

根据documentationAmazonHTTPClient.builder()返回的类可以在其上设置ClientConfiguration对象。错误消息表明这是必需的。