Connecting to AWS Elasticsearch from non-AWS node.js app


I’m working on puzzling out an infrastructure-ish issue with a project I’m working on. The service that I’m developing is hosted on a transient, containerized platform w/o a stable IP — only a domain name ( I’m utilizing Elasticsearch for search, so requests go to something like /my-search-resource and then use ES to find results to return. It’s written in node and uses the supported elasticsearch driver to connect to ES.

The issue I’m having is in trying to use an AWS Elasticsearch domain. This project is bootstrapped, so I’m taking advantage of the free-tier from AWS, even though the other services are hosted/deployed on another platform (think: heroku, GCP, etc. — containerized and transient resources).

Since I can’t just whitelist a particular IP, I’m not sure what I should do to enable the service to have access to the service. I do need to sign every request sent to the domain? This isn’t ideal, since it would require monkey-patching the ES driver library with that functionality. Ideally, I’d like to just use username & pw to connect to the domain, but I know IAM isn’t really oriented for something like that from an external service. Any ideas? Is this even something possible?


In my current project we connect to AWS Elastic by using the normal elasticsearch NPM package, and then use http-aws-es to create a specific AWS connection header when connecting.

So for example we have something like this:

That wouldn’t require the whole AWS SDK, but it would allow you to connect to Elastic’s that are behind the AWS. Is that a solution to your issue?

Leave a Reply