# Enroll elastic agent on machine that doesn't directly reach the Elastic Cloud instance

**URL:** <https://discuss.elastic.co/t/enroll-elastic-agent-on-machine-that-doesnt-directly-reach-the-elastic-cloud-instance/324405>\
**Category:** Elastic Agent\
**Tags:** fleet\
**Created:** [February 1, 2023, 9:35am UTC](https://discuss.elastic.co/t/enroll-elastic-agent-on-machine-that-doesnt-directly-reach-the-elastic-cloud-instance/324405 "2023-02-01T09:35:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gab](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gab/32/116638_2.png) [@gab](https://discuss.elastic.co/u/gab)\
**Post date:** [February 1, 2023, 9:35am UTC](https://discuss.elastic.co/t/enroll-elastic-agent-on-machine-that-doesnt-directly-reach-the-elastic-cloud-instance/324405/1 "2023-02-01T09:35:13Z")

</div>

Hi. I have an Elastic Cloud 8.4 instance and I have to install an elastic-agent on a protected machine A that doesn't directly reach the internet but reaches another machine B that does.  
So I have something like: A -\> B -\> Elastic Cloud 8.4

What I have done:

- Installed and configured logstash on machine B to forward data from port 5044 to Elastic Cloud.
- Configured that logstash instance as possible output in Elastic Cloud.
- Installed an elastic-agent with "Fleet Server" integration on machine B, added its url to the "Fleet server hosts" in Elastic Cloud.
- Created a fleet policy for machine A and selected logstash as default output.

The problem is that when I try to enroll the agent on machine A, even if I specify machine B url as fleet-server in the command, the agent tries to enroll directly to Elastic Cloud and fails.

Am I missing something? Is there a way to force machine A to pass throgh machine B for: enrollment, fleet management and data? Perhaps the only way is using a standalone agent.

---

<div class="post-metadata">

**Author:** ![Julia\_Bardi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julia_bardi/32/79463_2.png) [@Julia\_Bardi](https://discuss.elastic.co/u/Julia_Bardi)\
**Post date:** [February 13, 2023, 3:03pm UTC](https://discuss.elastic.co/t/enroll-elastic-agent-on-machine-that-doesnt-directly-reach-the-elastic-cloud-instance/324405/3 "2023-02-13T15:03:23Z")

</div>

Hi gab,

I don't think a Logstash output works to forward Agent data through another machine.  
You should look at using a proxy server through machine B: [Use a proxy server with Elastic Agent and Fleet | Fleet and Elastic Agent Guide [8.6] | Elastic](https://www.elastic.co/guide/en/fleet/current/fleet-agent-proxy-support.html)

---

<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:** [March 13, 2023, 3:03pm UTC](https://discuss.elastic.co/t/enroll-elastic-agent-on-machine-that-doesnt-directly-reach-the-elastic-cloud-instance/324405/4 "2023-03-13T15:03:31Z")

</div>

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