Connection between Elastic Agent (on local machine) and Elasticsearch (on GCP)

Hi @Nghia_Vu Welcome to the community

Well that is the correct approach :slight_smile:

Since this is just a study project you could enroll the Agent with the --insecure flag so certificate validation is not performed. Perhaps try that

--insecure

Allow the Elastic Agent to connect to Fleet Server over insecure connections. This setting is required in the following situations:

  • When connecting to an HTTP server. The API keys are sent in clear text.
  • When connecting to an HTTPs server and the certificate chain cannot be verified. The content is encrypted, but the certificate is not verified.
  • When using self-signed certificates generated by Elastic Agent.

We strongly recommend that you use a secure connection.

You could also look through this thread