# Not Able to connect my apm-agent to my apm -server hosted on different aws servers

**URL:** <https://discuss.elastic.co/t/not-able-to-connect-my-apm-agent-to-my-apm-server-hosted-on-different-aws-servers/281873>\
**Category:** APM\
**Tags:** java, server\
**Created:** [August 18, 2021, 7:51pm UTC](https://discuss.elastic.co/t/not-able-to-connect-my-apm-agent-to-my-apm-server-hosted-on-different-aws-servers/281873 "2021-08-18T19:51:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harshil\_Narielwala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshil_narielwala/32/54024_2.png) [@Harshil\_Narielwala](https://discuss.elastic.co/u/Harshil_Narielwala)\
**Post date:** [August 18, 2021, 7:51pm UTC](https://discuss.elastic.co/t/not-able-to-connect-my-apm-agent-to-my-apm-server-hosted-on-different-aws-servers/281873/1 "2021-08-18T19:51:08Z")

</div>

Hi Team,

I have hosted an apm-server on one of my servers with host as localhost:8200.  
I am using a java application via tomcat and I have provided -Delastic.apm.server\_url=http://apm-server-ip:8200

But the java application provides the below error

ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error trying to connect to APM Server at http:// **.**. **.** :8200/intake/v2/events. Some details about SSL configurations corresponding the current connection are logged at INFO level.  
2021-08-18 19:49:42,956 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type JSON\_WRITER with this error: Connection refused (Connection refused)  
2021-08-18 19:49:42,956 [elastic-apm-server-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 0 seconds (+/-10%)  
2021-08-18 19:49:43,154 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error trying to connect to APM Server at http:// **.**. **.** :8200/intake/v2/events. Some details about SSL configurations corresponding the current connection are logged at INFO level.  
2021-08-18 19:49:43,154 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type JSON\_WRITER with this error: Connection refused (Connection refused)  
2021-08-18 19:49:43,154 [elastic-apm-server-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 1 seconds (+/-10%)  
2021-08-18 19:49:44,385 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Error trying to connect to APM Server at http:// **.**. **.** :8200/intake/v2/events. Some details about SSL configurations corresponding the current connection are logged at INFO level.  
2021-08-18 19:49:44,386 [elastic-apm-server-reporter] ERROR co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Failed to handle event of type JSON\_WRITER with this error: Connection refused (Connection refused)  
2021-08-18 19:49:44,386 [elastic-apm-server-reporter] INFO co.elastic.apm.agent.report.IntakeV2ReportingEventHandler - Backing off for 4 seconds (+/-10%)

When I set up the APM -server and APM-agent on the same server it works fine but if it's on a separate box I am getting the above error

can someone guide me how to solve this

---

<div class="post-metadata">

**Author:** ![Ramon\_Sanchez\_Villan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ramon_sanchez_villan/32/48235_2.png) [@Ramon\_Sanchez\_Villan](https://discuss.elastic.co/u/Ramon_Sanchez_Villan)\
**Post date:** [August 18, 2021, 9:54pm UTC](https://discuss.elastic.co/t/not-able-to-connect-my-apm-agent-to-my-apm-server-hosted-on-different-aws-servers/281873/2 "2021-08-18T21:54:17Z")

</div>

Hi, can you please fire this link [http://apm-server-ip:8200](http://apm-server-ip:8200) and share output, but use command line or internet browser. If you are using Linux OS, you can fire this command: curl "[http://apm-server-ip:8200](http://apm-server-ip:8200)".

---

<div class="post-metadata">

**Author:** ![Harshil\_Narielwala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshil_narielwala/32/54024_2.png) [@Harshil\_Narielwala](https://discuss.elastic.co/u/Harshil_Narielwala)\
**Post date:** [August 19, 2021, 9:14am UTC](https://discuss.elastic.co/t/not-able-to-connect-my-apm-agent-to-my-apm-server-hosted-on-different-aws-servers/281873/3 "2021-08-19T09:14:53Z")

</div>

> [@Ramon\_Sanchez\_Villan](#):
>
> [http://apm-server-ip:8200](http://apm-server-ip:8200)

Hi Ramon

I was able to sort out the problem.  
Thanks for the help 🙂

---

<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:** [September 9, 2021, 5:15am UTC](https://discuss.elastic.co/t/not-able-to-connect-my-apm-agent-to-my-apm-server-hosted-on-different-aws-servers/281873/4 "2021-09-09T05:15:22Z")

</div>

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