Access VM instance from Google Cloud Function via internal ip address

流过昼夜 提交于 2019-12-11 06:11:54

问题


I have a VM instance with Redis running on internal ip 10.132.0.3 also it's external ip is 35.233.12.123 I'd like to connect to it from google cloud function. But there is no connection via internal ip, while connection via external ip works. As I understand Google's cloud functions don't have access to VPC networks and my instances in it via internal ip addresses. So the questiona are:

  1. Is it possible to access the VM instance by internal ip from cloud function somehow?

  2. The external ip belongs to google so the traffic shouldn't go outside of the google's datacenter anyway, I suppose. So if to use external ip in my case will this have influence on connection speed? Will the traffic be billed as external? What are the downsides of connecting to my Redis VM instance via external ip?


回答1:


  1. Is it possible to access the VM instance by internal ip from cloud function somehow?

Google has announce alpha availability to connect from Cloud Functions to Compute Engine using VPC private IP addresses. You need to sign up here.

Otherwise you will need to use the public IP address from Cloud Functions to Compute Engine.

  1. The external ip belongs to google so the traffic shouldn't go outside of the google's datacenter anyway, I suppose.

The answer to this question depends on which region the Cloud Function executes in and the type of networking (Standard Tier or Premium Tier) enabled on your Compute Instance. Traffic within the same region always travels over Premium Tier which means Google's private backbone.

Premium Tier will route traffic thru Google's backbone to a exit point closest to the client (Cloud Functions). This means that your traffic will stay on Google's backbone.

Standard Tier does not travel on Google's backbone - however, I cannot find a authoritative reference for Google traffic between regions using Standard Tier. My understanding is that region to region traffic using Standard Tier is over the public Internet.

Cloud Network Service Tiers Overview

Cloud Function Locations

So if to use external ip in my case will this have influence on connection speed?

Internet and Intranet traffic performance is affected by many factors. Premium Tier traffic is a well-provisioned, low latency, highly reliable global network. This indicates higher performance.

Will the traffic be billed as external?

I am not 100% sure but I believe all traffic that exits a region is billed as external traffic.

Pricing

What are the downsides of connecting to my Redis VM instance via external ip?

The downside is security of your data. All traffic should be encrypted, IMHO without exception.



来源:https://stackoverflow.com/questions/53108916/access-vm-instance-from-google-cloud-function-via-internal-ip-address

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!