I have a Lambda written in Python which writes some data to Elasticsearch hosted on AWS. The ES service is within a VPC, so I'm trying to use the internal DNS of the ES to connect to it. This is my code:
es_client = Elasticsearch(
hosts=[{'host': es_host, 'port': 443}],
http_auth=aws_auth,
use_ssl=True,
verify_certs=True,
connection_class=RequestsHttpConnection
)
However, I get this exception:
ssl.CertificateError: hostname 'x.y.internal' doesn't match '*.us-west-2.es.amazonaws.com
I don't wan't to use the public hostname because it is going to keep changing. How do I connect to the ES service using it's internal DNS?
====== UPDATE =======
I'm able to connect to the ES domain using HTTP with the below code:
es_client = Elasticsearch(
hosts=[{'host': es_host, 'port': 80}]
)
But how do I connect over HTTPS?