I want to access a REST server that is hosted locally in a windows virtual machine (VM) in a GCP project. Also, the VPC network within my GCP project has a VPN tunnel with an external client. I plan to host my project using the google app engine. But I want to make sure it is in the same VPC network as the VM. In that case I can make API requests using the internal IP of the VM.
Based on my understanding, the app engine may not be in the same VPC network as the VM. I stumbled upon serverless VPC. Is that the solution I am looking for? Will it connect my app engine in the same VPC as the VM?
Short answer: Yes
When you create a VPC Connector and associate it to you App Engine service you're able to talk to resources living in the VPC where the connector was created.
So the real condition here is that the connector is in the same VPC as the VMs.
In the same doc are the steps to create one and associate it with your App Engine service.
As an additional step, when your service tries to reach the VM, use the internal IP of the VM instead of the public one (if any). This will keep the connections private inside the VPC.