# EC2 discovery plugin

**URL:** <https://discuss.elastic.co/t/ec2-discovery-plugin/381041>\
**Category:** Elastic Search\
**Created:** [August 14, 2025, 12:24pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041 "2025-08-14T12:24:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![brjisc](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@brjisc](https://discuss.elastic.co/u/brjisc)\
**Post date:** [August 14, 2025, 12:24pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041/1 "2025-08-14T12:24:34Z")

</div>

ES 9.1.2

Using the EC2 discovery plugin with the following config:

```auto
network.host: _ec2_

```

```auto
        node.roles: ["master"]

```

```auto
        discovery.seed_providers: ec2

```

```auto
        discovery.ec2.tag.ESRole: master

```

```auto
        discovery.ec2.host_type: private_ip

```

```auto
        discovery.ec2.endpoint: ec2.eu-west-1.amazonaws.com

```

```auto
        discovery.ec2.availability_zones: eu-west-1a

```

```auto
        cluster.initial_master_nodes:

```

```auto
          - master-0

```

Getting the error:

`[o.e.d.e.AwsEc2SeedHostsProvider] [master-0] Exception while retrieving instance list from AWS API: protocol must not be null.`

The docs state that this has a default value so I have not set:

`discovery.ec2.protocol`

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [August 14, 2025, 12:50pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041/2 "2025-08-14T12:50:07Z")

</div>

Hello @brjisc

As per the documentation :

```auto
discovery.ec2.endpoint
The EC2 service endpoint to which to connect. See https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region to find the appropriate endpoint for the region. This setting defaults to ec2.us-east-1.amazonaws.com which is appropriate for clusters running in the us-east-1 region.

```

> **[AWS service endpoints - AWS General Reference](https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region)**
>
> Find the endpoints for AWS services.

It seems you need to add protocol you are using in the endpoint :

`protocol://service-code.region-code.amazonaws.com`

Thanks!!

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [August 14, 2025, 12:56pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041/3 "2025-08-14T12:56:51Z")

</div>

Hmm the docs for `discovery.ec2.endpoint` say:

> This setting defaults to `ec2.us-east-1.amazonaws.com` which is appropriate for clusters running in the `us-east-1` region.

I do not think this is true, at least not in 9.1+. Does it work to drop this setting entirely? I would expect the SDK to be able to detect that it’s running in `eu-west-1` and thus use the right endpoint automatically.

If you confirm that it works without this setting, I’ll update the docs. If not, what @Tortoise said is right, you need to say `https://ec2.eu-west-1.amazonaws.com` instead.

---

<div class="post-metadata">

**Author:** ![brjisc](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@brjisc](https://discuss.elastic.co/u/brjisc)\
**Post date:** [August 14, 2025, 1:36pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041/4 "2025-08-14T13:36:17Z")

</div>

I have added the protocol to the endpoint and the cluster now forms correctly.

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [August 14, 2025, 1:55pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041/5 "2025-08-14T13:55:30Z")

</div>

Sure, but could you try it without `discovery.ec2.endpoint` too? It shouldn’t be necessary to set this.

---

<div class="post-metadata">

**Author:** ![brjisc](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@brjisc](https://discuss.elastic.co/u/brjisc)\
**Post date:** [August 14, 2025, 2:08pm UTC](https://discuss.elastic.co/t/ec2-discovery-plugin/381041/6 "2025-08-14T14:08:18Z")

</div>

I will test this next week.
