Elastic Agent Not Sending Logs from Endpoint Outside the Network (AWS Cloud deployemnt on VM)

Hello!

Description:
I have deployed a setup on AWS with two VMs:

  1. One VM running Elasticsearch.
  2. Another VM running Kibana and Fleet Server.

Issue:
When I try to install an agent to collect logs from an endpoint, Elastic only receives the status and health information, but no logs are sent.
However, if the endpoint is within the network (not outside the network), it successfully sends the logs as shown below in the snap

and when I tried to add the elastic defend policy to see if there was any error I found the below error

Question:
Is this issue related to AWS configuration, or is there something missing in the ELK configuration? What steps can I take to resolve this issue and ensure that logs are correctly collected from endpoints outside the network?