# Can we add a network load balancer on top of Aws OpenSearch Service. Our requirement is to run logstash in ECS and route the traffic to these from specific ports via NLB. But I didn’t found good sources to implement it.

**URL:** <https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306>\
**Category:** AWS Networking\
**Tags:** ecs, load-balancer, opensearch\
**Created:** [July 26, 2022, 4:08pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306 "2022-07-26T16:08:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dheerajs9999](https://awshq.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@Dheerajs9999](https://awshq.com/u/Dheerajs9999)\
**Post date:** [July 26, 2022, 4:08pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/1 "2022-07-26T16:08:12Z")

</div>

_Can we add a network load balancer on top of Aws OpenSearch Service. Our requirement is to run logstash in ECS and route the traffic to these from specific ports via NLB. But I didn’t found good sources to implement it._

* * *

**Related discussions:**

- [Why does restricting NLB SG to VPC CIDR cause timeouts?](https://awshq.com/t/why-does-restricting-nlb-sg-to-vpc-cidr-cause-timeouts/20234)
- [Best storage option for versioning something](https://awshq.com/t/best-storage-option-for-versioning-something/19848)
- [Business Support Appreciation Thread](https://awshq.com/t/business-support-appreciation-thread/19923)
- [Using Non-VPC Lambdas in a Web Application](https://awshq.com/t/using-non-vpc-lambdas-in-a-web-application/20353)
- [Lessons from building centralized ingress and egress inspection with GWLB and Palo Alto VM-Series (and what I’d change in 2026)](https://awshq.com/t/lessons-from-building-centralized-ingress-and-egress-inspection-with-gwlb-and-palo-alto-vm-series-and-what-id-change-in-2026/21702)

---

<div class="post-metadata">

**Author:** ![pojzon\_poe](https://awshq.com/letter_avatar_proxy/v4/letter/p/e495f1/32.png) [@pojzon\_poe](https://awshq.com/u/pojzon_poe)\
**Post date:** [July 27, 2022, 6:21am UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/2 "2022-07-27T06:21:19Z")

</div>

What would be the target group of that NLB ?

IPs of LB thats behind OpenSearch generated managed url ?

Those IPs can change over time and you have no control over that.

Better thing to do is to expose OpenSearch via custom domain and configure logstash as a daemonset which forwards to OS.

Example on ECS can be any daemonset deployment tbh.

---

<div class="post-metadata">

**Author:** ![Dheerajs9999](https://awshq.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@Dheerajs9999](https://awshq.com/u/Dheerajs9999)\
**Post date:** [July 27, 2022, 11:53am UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/3 "2022-07-27T11:53:29Z")

</div>

> [@pojzon\_poe](#):
>
> What would be the target group of that NLB ? IPs of LB thats behind OpenSearch generated managed url ? Those IPs can change over time and you have no control over that. Better thing to do is to expose OpenSearch via …

Yes we can forward to OpenSearch from logstash. But the thing is we want to have a nlb on both logstash in ECS and managed OpenSearch so we will alias the nlb generated host name in Route 53 record. So want to add this record where the logs are writing from 2 ports. And we want to use the same route 53 url to access the kibana dashboard from port 443.

So 2 ports should hit the logstash in ECS where the logs are writing from and port 443 should hit kibana dashboard(OpenSearch)

Logstash will send the logs to OpenSearch without nlb anyways.

---

<div class="post-metadata">

**Author:** ![pojzon\_poe](https://awshq.com/letter_avatar_proxy/v4/letter/p/e495f1/32.png) [@pojzon\_poe](https://awshq.com/u/pojzon_poe)\
**Post date:** [July 27, 2022, 12:11pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/4 "2022-07-27T12:11:42Z")

</div>

> [@Dheerajs9999](#):
>
> Yes we can forward to OpenSearch from logstash. But the thing is we want to have a nlb on both logstash in ECS and managed OpenSearch so we will alias the nlb generated host name in Route 53 record. So want to add this …

Register logstash in one target group. Create your own proxy for sending to OS. Configure logstash to write to proxy.

Configure nginx to expose everything on different ports.

But I see absolutely no reason to do it this way.

---

<div class="post-metadata">

**Author:** ![Dheerajs9999](https://awshq.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@Dheerajs9999](https://awshq.com/u/Dheerajs9999)\
**Post date:** [July 27, 2022, 12:13pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/5 "2022-07-27T12:13:55Z")

</div>

> [@pojzon\_poe](#):
>
> Register logstash in one target group. Create your own proxy for sending to OS. Configure logstash to write to proxy. Configure nginx to expose everything on different ports. But I see absolutely no reason to do it this …

The problem is not logstash writing to OS it can write with or without nlb/proxy. The only reason for nlb is it should direct the traffic to logstash and OS based on the incoming ports.

---

<div class="post-metadata">

**Author:** ![pojzon\_poe](https://awshq.com/letter_avatar_proxy/v4/letter/p/e495f1/32.png) [@pojzon\_poe](https://awshq.com/u/pojzon_poe)\
**Post date:** [July 27, 2022, 12:55pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/6 "2022-07-27T12:55:59Z")

</div>

> [@Dheerajs9999](#):
>
> The problem is not logstash writing to OS it can write with or without nlb/proxy. The only reason for nlb is it should direct the traffic to logstash and OS based on the incoming ports.

Issue is NLB cannot do that. Car no go space, car no fly.

And it makes no sense to put NLB between containers in ECS. Thats what host bridge network is for.

---

<div class="post-metadata">

**Author:** ![Dheerajs9999](https://awshq.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@Dheerajs9999](https://awshq.com/u/Dheerajs9999)\
**Post date:** [July 27, 2022, 12:57pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/7 "2022-07-27T12:57:28Z")

</div>

> [@pojzon\_poe](#):
>
> Issue is NLB cannot do that. Car no go space, car no fly. And it makes no sense to put NLB between containers in ECS. Thats what host bridge network is for.

So we cannot host nlb on top of OpenSearch?

---

<div class="post-metadata">

**Author:** ![pojzon\_poe](https://awshq.com/letter_avatar_proxy/v4/letter/p/e495f1/32.png) [@pojzon\_poe](https://awshq.com/u/pojzon_poe)\
**Post date:** [July 27, 2022, 2:33pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/8 "2022-07-27T14:33:53Z")

</div>

> [@Dheerajs9999](#):
>
> So we cannot host nlb on top of OpenSearch?

No because you have no way to define target group for OS..

---

<div class="post-metadata">

**Author:** ![Dheerajs9999](https://awshq.com/letter_avatar_proxy/v4/letter/d/b3f665/32.png) [@Dheerajs9999](https://awshq.com/u/Dheerajs9999)\
**Post date:** [July 27, 2022, 2:51pm UTC](https://awshq.com/t/can-we-add-a-network-load-balancer-on-top-of-aws-opensearch-service-our-requirement-is-to-run-logstash-in-ecs-and-route-the-traffic-to-these-from-specific-ports-via-nlb-but-i-didn-t-found-good-sources-to-implement-it/15306/9 "2022-07-27T14:51:39Z")

</div>

> [@pojzon\_poe](#):
>
> No because you have no way to define target group for OS..

So do you suggest adding a proxy on top on OS and add that proxy in target group
