简体   繁体   中英

Passing Data from App Engine to Compute Engine

I have built an full stack MERN app and deployed it with App Engine. The app uploads data to a google Cloud Storage bucket where an AI program running on a Compute Engine analyzes the files and places them in another Storage bucket. I am using Cloud Functions to trigger a command on the Compute Engine when the bucket is updated, but I'm lost on how to connect to the Compute Engine in the Cloud Function. The AI program is a Python program. Any help/suggestions would be greatly appreciated.

Simplest solution Make the GCE instance have a public IP and from Cloud Functions make a request to you instance . You can protect the GCE endpoint by this solution by adding a Identity-Aware Proxy on the port that is exposing the remote execution service. And add the Cloud Function service account to the list of accepted users.

Suggested soltuion In order to send data to Compute Engine from Cloud Functions internally you need to create a connection between the Cloud Function and the VPC network that holds the instance.

You will find the instructions on how to do this on Connecting to a VPC network .

Then, once the Cloud Function has access to the VPC network, you have to make a request using the instance private IP.


When I say to make a request I mean that you need service on you GCE instance that is listening to request Eg: a flask application and executes the command on the request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM