# APM Server -\> AWS Elasticsearch Service: "cannot retrieve the elasticsearch license: unauthorized access, could not connect to the xpack endpoint, verify your credentials"

**URL:** <https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759>\
**Category:** APM\
**Created:** [November 13, 2019, 6:00pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759 "2019-11-13T18:00:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hickeroar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hickeroar/32/57628_2.png) [@hickeroar](https://discuss.elastic.co/u/hickeroar)\
**Post date:** [November 13, 2019, 6:00pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/1 "2019-11-13T18:00:28Z")

</div>

**Kibana version** : 7.1.1

**Elasticsearch version** : 7.1.1

**APM Server version** : 7.1.1

**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
DEB:

```auto
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-7.1.1-amd64.deb
sudo dpkg -i apm-server-7.1.1-amd64.deb

```

**Fresh install or upgraded from other version?**  
Fresh

**Is there anything special in your setup?**  
It's AWS's elasticsearch service.  
apm-server is running on an ubuntu 18.04 instance. They're in the same VPC.

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:  
I may have some misconceptions or issues with my setup, so please correct me if I'm wrong on any of this.

The log output, trying to connect to my elasticsearch instance displays:

```auto
Connection marked as failed because the onConnect callback failed: cannot retrieve the elasticsearch license: unauthorized access, could not connect to the xpack endpoint, verify your credentials

```

It appears that AWS runs on port 443 instead of 9200:

```auto
curl -XGET 'https://<snip>.us-east-1.es.amazonaws.com:443'

```

Yields:

```auto
      "name" : "<snip>",
      "cluster_name" : "<snip>",
      "cluster_uuid" : "<snip>",
      "version" : {
        "number" : "7.1.1",
        "build_flavor" : "oss",
        "build_type" : "tar",
        "build_hash" : "7a013de",
        "build_date" : "2019-09-05T07:25:23.525600Z",
        "build_snapshot" : false,
        "lucene_version" : "8.0.0",
        "minimum_wire_compatibility_version" : "6.8.0",
        "minimum_index_compatibility_version" : "6.0.0-beta1"
      },
      "tagline" : "You Know, for Search"
    }

```

Does anyone know what I may be doing wrong here?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 13, 2019, 8:31pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/2 "2019-11-13T20:31:15Z")

</div>

APM is not compatible with the aws service unfortunately.

Try [https://www.elastic.co/products/elasticsearch/service](https://www.elastic.co/products/elasticsearch/service) instead 🙂

---

<div class="post-metadata">

**Author:** ![hickeroar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hickeroar/32/57628_2.png) [@hickeroar](https://discuss.elastic.co/u/hickeroar)\
**Post date:** [November 13, 2019, 9:24pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/3 "2019-11-13T21:24:58Z")

</div>

> [@APM and AWS Elasticsearch](https://discuss.elastic.co/t/apm-and-aws-elasticsearch/131361):
>
> Has anyone setup an APM server to connect to AWS ES? Is it compatible? If so, help a newbie out with the output configuration?

This thread seems to say that it's possible just by putting in the hostname of the aws instance and proper port.

Has that compatibility been lost along the way?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 13, 2019, 9:26pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/4 "2019-11-13T21:26:39Z")

</div>

Ahh right, I missed that nuance sorry!

---

<div class="post-metadata">

**Author:** ![hickeroar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hickeroar/32/57628_2.png) [@hickeroar](https://discuss.elastic.co/u/hickeroar)\
**Post date:** [November 13, 2019, 9:28pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/5 "2019-11-13T21:28:57Z")

</div>

Well, I guess what I'm wondering is what's the process for getting that to actually happen? I've set things up as it was stated there:  
`To configure AWS Server to send data to a remote Elasticseach instance (as is the case with AWS ES), you need to specify the hostname/port of the AWS ES cluster using the output.elasticsearch.hosts config option.`

But...that led me to creating this thread in the first place.

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [November 18, 2019, 2:15pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/6 "2019-11-18T14:15:01Z")

</div>

@hickeroar You'll need to use the oss distribution of APM Server when using AWS' hosted service, [https://artifacts.elastic.co/downloads/apm-server/apm-server-oss-7.1.1-amd64.deb](https://artifacts.elastic.co/downloads/apm-server/apm-server-oss-7.1.1-amd64.deb) in your case. Any reason you have to use 7.1.1? We'd recommend the latest release if possible, it's compatible with ES 7.1.1 in case you are pinned to that version.

We've recently updated the error message to make it more clear:

```auto
Connection marked as failed because the onConnect callback failed: Apm-Server requires the default distribution of Elasticsearch. Please update to the default distribution of Elasticsearch for full access to all free features, or switch to the OSS distribution of Apm-Server.

```

---

<div class="post-metadata">

**Author:** ![hickeroar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hickeroar/32/57628_2.png) [@hickeroar](https://discuss.elastic.co/u/hickeroar)\
**Post date:** [November 19, 2019, 4:22pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/7 "2019-11-19T16:22:52Z")

</div>

OK thank you. Got it all sorted now.

---

<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:** [December 10, 2019, 12:22pm UTC](https://discuss.elastic.co/t/apm-server-aws-elasticsearch-service-cannot-retrieve-the-elasticsearch-license-unauthorized-access-could-not-connect-to-the-xpack-endpoint-verify-your-credentials/207759/8 "2019-12-10T12:22:53Z")

</div>

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