I am looking to make an api call into a server I host in a compute engine. I want to make this call from cloud function. How can I do this without exposing the Compute Engine to the public?
So if I am understanding this correctly, you have a private Cloud Function and you want it to make calls to an API on a private Compute Engine VM is that correct?
If this is the case, then what I think you need to set up a Serverless VPC Access. Serverless VPC Access allows your private serverless services (i.e. CF, Cloud Run, App Engine) to connect to resources in your VPCs. You can think of it like VPC peering in a sense.