Google has documentation for setting up an external IP for App Engine Standard. However, I have a requirement to set up an external IP for App Engine Flex.
I have followed the tutorial and successfully created a subnetwork with a Cloud Router and Cloud NAT that is connected to an external static IP. I tested that the setup works by creating a VM instance in it, and seeing that all egress traffic does indeed originate from the reserved external static IP.
However, when I deploy the App Engine Flex app to this subnetwork, its requests are not routed through the reserved static IP, but appear to be using the shared IP address pool provided by Google. Everything works normally, and there are no deploy errors, just the reserved external IP is not used. The app is assigned to the subnetwork in app.yaml:
network:
name: default
subnetwork_name: app-engine-subnet
Any hints on getting this Flex instance to route its egress traffic through the reserved external IP? I am aware that this can be done using a VM instance as a proxy, but I'd prefer using Cloud NAT instead.
CodePudding user response:
Per the Google Cloud NAT documentation, Cloud NAT cannot be used with VMs that have an external IP address. App Engine Flex does not support VMs with internal IPs only (Google App Engine documentation), so NAT will not work.