# EC2 cURL localhost:9200 - security\_exception

**URL:** <https://discuss.elastic.co/t/ec2-curl-localhost-9200-security-exception/291441>\
**Category:** Elasticsearch\
**Created:** [December 10, 2021, 3:55pm UTC](https://discuss.elastic.co/t/ec2-curl-localhost-9200-security-exception/291441 "2021-12-10T15:55:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmiklas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmiklas/32/50730_2.png) [@kmiklas](https://discuss.elastic.co/u/kmiklas)\
**Post date:** [December 10, 2021, 3:55pm UTC](https://discuss.elastic.co/t/ec2-curl-localhost-9200-security-exception/291441/1 "2021-12-10T15:55:02Z")

</div>

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:

```auto
sudo curl -XGET http://localhost:9200

```

Response:

```auto
{
  "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
}

```

---

<div class="post-metadata">

**Author:** ![kmiklas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kmiklas/32/50730_2.png) [@kmiklas](https://discuss.elastic.co/u/kmiklas)\
**Post date:** [December 10, 2021, 4:31pm UTC](https://discuss.elastic.co/t/ec2-curl-localhost-9200-security-exception/291441/2 "2021-12-10T16:31:45Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![cronlabspl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cronlabspl/32/83646_2.png) [@cronlabspl](https://discuss.elastic.co/u/cronlabspl)\
**Post date:** [December 10, 2021, 5:21pm UTC](https://discuss.elastic.co/t/ec2-curl-localhost-9200-security-exception/291441/3 "2021-12-10T17:21:37Z")

</div>

@kmiklas this has to be done as priviledged user

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 7, 2022, 5:21pm UTC](https://discuss.elastic.co/t/ec2-curl-localhost-9200-security-exception/291441/4 "2022-01-07T17:21:51Z")

</div>

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