Jackson
Jackson

Reputation: 1524

AWS ElasticSearch Request not giving response in Postman

https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-use-postman-to-call-api.html

I am following above document, to connect to my AWS Elastic Search via Postman.

What I want to achieve sent request & get the response.

I put all things related Authentication as well, still it is giving timeout error.

It is giving error 'Could not get any response'.

My Postman settings related to SSL is also correct

Sample URL :

https://vpc-abc-yqb7jfwa6tw6ebwzphynyfvaka.ap-southeast-1.es.amazonaws.com/elasticsearch_index/_search?source={"query":{"bool":{"should":[{"multi_match":{"query":"abc","fields":["name.suggestion"],"fuzziness":1}}]}},"size":10,"_source":["name"],"highlight":{"fields":{"name.suggestion":{}},"pre_tags":["\u003Cem\u003E"],"post_tags":["\u003C\/em\u003E"]}}&source_content_type=application/json

enter image description here

Upvotes: 0

Views: 5479

Answers (2)

Marcin
Marcin

Reputation: 238957

Since your ES domain is in the VPC, you can't access if from the internet. The use of security groups and "allowing port" is unfortunately not enough.

The following is written in the docs:

If you try to access the endpoint in a web browser, however, you might find that the request times out. To perform even basic GET requests, your computer must be able to connect to the VPC. This connection often takes the form of a VPN, managed network, or proxy server.

Some options to consider are:

  • Setup a bastion host in the VPC in its public subnet, and ssh tunnel connection from the ES to your local mac through the bastion host. This would be the easiest ad-hoc proxy solution mentioned in the docs.

  • Accessing the EC directly from the bastion host (e.g. remote desktop)

  • Setting up a proxy server to proxy all requests from the internet into the ES.

Upvotes: 1

Bhavya
Bhavya

Reputation: 16192

For creating and managing ES domain you can refer this documentation.

While creating ES domain in the Network configuration section, you can choose either VPC access or Public access. If you select public access, you can secure your domain with an access policy that only allows specific users or IP addresses to access the domain.

To know more about access policies, you can refer this SO answer.

So, if you create your ES domain outside VPC, in public access you can easily send request and get response through postman, without adding any Authorization.

The endpoint in the url, is the endpoint that is generated when you have created your ES domain.

To create an index

enter image description here

For adding data into the index

enter image description here

Get API to get the mapping of index created

enter image description here

Now, you can check it from your AWS console, that this index is created in the ES domain

enter image description here

Upvotes: 0

Related Questions