简体   繁体   中英

How do you connect Google App Engine NodeJS app to MongoDB in Compute Engine?

I have a Google App Engine project that was written in nodeJS . The Project requires a MongoDB server. Hosted Preferrably in Compute Engine. How do I connect the App Engine to the Compute Engine, Given how the App Engine will always have a Dynamic IP and thus cant be added to the white list of Compute Engine?

Your compute engine runs on your VPC. Therefore, to secure the communication, you have to use the compute engine private IP from your App Engine.

However, App Engine doesn't live in your VPC, but in the serverless world managed by Google Cloud. For that, you have to bridge the 2 worlds with a serverless VPC connector .

When it's done, simply use the private IP of your Compute Engine with MongoDB to access it.


However, hosting yourselves a MongoDB server isn't a good idea. You have useful and powerful serverless hosting with MongoDB Atlas solution on Google Cloud. I strongly recommend to have a look on it to increase the security, high availability and to reduce your operating cost

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