title: Why is my AWS Lambda function using the wrong URL to communicate with OpenSearch?
body: <p>I have a lambda function which needs to communicate with an AWS OpenSearch domain.</p>
  <p>The domain is contained within a VPC, and the lambda function has been placed within the same VPC and subnet.</p>
  <p>The VPC contains has an internet gateway and a proxy server, and the Opensearch Domain has a url accessible from outside the VPC in addition to its automatically-generated URL.</p>
  <p>When the lambda function attempts to connect to the Opensearch API, it times out. Weirdly, however, it shows that it's attempting to access the wrong URL. Regardless of whether I use the public-facing URL or the in-VPC url beginning with 'https://vpc-{my-vpc-name}&quot;, it shows that it timed out attempting to contact 'https://search-{my-vpc-name}'</p>
  <p>I believe that the relevant code is in here:</p>
  <pre><code>RestClientBuilder builder = RestClient.builder(HttpHost.create({my-url-here}))
      .setHttpClientConfigCallback(httpAsyncClientBuilder -&gt; httpAsyncClientBuilder.addInterceptorLast(interceptor));
  restClient = new RestHighLevelClient(builder);
  </code></pre>
  <p>I really don't understand why it would use the modified (and non-existent) URL regardless of what it's told to use. Could this be a DNS issue of some sort, or should I be looking more at how OpenSearch and the AWS Java library work?</p>