EC2 cURL localhost:9200 - security_exception

What is the simplest way to enable the health check of Elasticsearch? Do I have to set up AWS authentication, or can I bypass it for troubleshooting?

  • Connected to an AWS EC2 instance using a .pem file.
  • Elasticsearch is running
  • Attempting to check basic health with this command:
sudo curl -XGET http://localhost:9200

Response:

{
  "error": {
    "root_cause": [
      {
        "type": "security_exception",
        "reason": "missing authentication credentials for REST request [/]",
        "header": {
          "WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
        }
      }
    ],
    "type": "security_exception",
    "reason": "missing authentication credentials for REST request [/]",
    "header": {
      "WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
    }
  },
  "status": 401
}

If you have the credentials, status can be obtained as follows:

curl -X GET localhost:9200?pretty --user "elastic:qwerty"

@kmiklas this has to be done as priviledged user

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.