Best way to secure a connection to an Elasticsearch instance on GCP so that only requests coming from Firebase cloud functions are accepted

Hi. I wanted to know what’s the best way to secure a connection to my Elasticsearch instance on GCP so that only requests coming from my Firebase cloud functions are accepted and all other sources rejected.

I’m having a lot of trouble understanding the different security options, and which would be the most appropriate for my case.

I’ve been reading the documentation for different approaches like using Cloud IAM Service Accounts with Private Keys to secure the instance, but I’m not fully convinced yet. Furthermore I managed to find a youtube demo provided by Elastic: "Secure your deployments on Elastic Cloud with Private Link" where they specify that Private Link is the preferred way to set up a secure connection like the one I need (for which the only official documentation I found was: GCP Private Service Connect traffic filters | Elasticsearch Service Documentation | Elastic).

Due to the complexity of the methods I’ve been able to find so far, I’m not convinced I’m going on about this the proper way, even more so, I cant manage to find a reliable way to estimate the cost associated with running each of these solutions. Additionally, for the case of setting up Private Link, I don’t fully understand how does a GCP VPC relate to my (Firebase) cloud functions or how to link them together.

Has anyone done anything similar?

I don’t know if I’m being to paranoid with respect to my instance’s security since this is a very small commercial project, but I’m fairly concerned about securing access to the Elasticsearch instance since it seems that somehow, the elastic user and password do not limit inbound requests being accepted.

A couple of years ago I tried a similar solution for another project (that didn’t end up using Elasticsearch), on a managed instance on GCP that wasn’t provided by Elastic Cloud, and even while running some simple tests from my PC without uploading the project and thus without any way of leaking my credentials my Elasticsearch instance was breached. Luckily it only had a couple of documents in the form {test: “test value”}, but obviously, if this can still happen, this makes the current setup unacceptable for actual project deployment.