I've got a managed autoscaling group set up behind a load balancer in Google Compute. It's working well, and adds / removes instances as it should.
Is is possible to specify (in any way) the external IP address which is allocated to the instances in the group?
I was hoping that if I reserved static IP addresses, then the new machines would use them but instead they just seem to still use a random one from the ephemeral pool.
The issue is that the payment gateway we're using (Sagepay) needs to know the IP address of the servers that are sending payment requests. It can handle a class C subnet but obviously I need to be able to ensure that machines are getting IPs in the right range.
The only other possibility I could come up with was to try and proxy the outgoing traffic to Sagepay via a single machine on a known IP, but that seems like a poor solution!
Any hints appreciated.
If you are using Network loadbalancer you can unassign your reserved static IP from instance and assign it to loadbalancer's forwarding rule in the same zone. For more information you can refer to this link [1].
In case you are using HTTP(S) loadbalancer, you need to reserve global static IP for forwarding rule which doesn't require zone. For more information you can refer to this link [2].
As such, for HTTP(S) loadbalancer the easiest option would be to reserve global static IP address and whitelist it with your payment gateway (Sagepay).
[1] https://cloud.google.com/compute/docs/load-balancing/network/forwarding-rules [2] https://cloud.google.com/compute/docs/load-balancing/http/global-forwarding-rules