google-cloud-platformreverse-proxystatic-ip-address

Is there any Google Cloud product that acts as a reverse proxy?


I have a microservice that, through a cloud function, sets up various virtual machines to scrape a series of web pages. The hosts of these websites have requested all my machines to have a static IP so that it is easier for them to add me to their whitelist, since currently the external IPs of my machines are dynamic. Is there any Google Cloud product that acts as a reverse proxy? I think it is the most optimal solution, but I am open to hearing other ideas.

I tried setting up a static IP through VPC network, but it seems to be a 1-to-1 relationship between the machines and the IP, and I need them all to share the same IP.


Solution

  • It sounds like you are looking for a forward proxy that proxies the outbound egress traffic using a stable set of IP address(es). There are couple of options to consider.

    1. Cloud NAT. It is a GCP native solution that control the source IP addresses for your egress traffic. You can choose Manual NAT IP address assignment to specific IPs. Note: Cloud NAT should not be used as full-fledged forward proxy as it lacks the advanced forward proxy features. It is recommended to configure your GCE VM instance with Internal IPs. Here is the high-level steps of using Cloud NAT:

      • Create a Cloud NAT Gateway (assign a static IP)
      • Configure the default route of your GCE VMs pointing to Cloud NAT gateway
      • (optional) review your VPC firewall rules to allow outbound traffic.
    2. Third-party Proxy. For more advanced forward proxy feature, you can configure forward proxy software (such as Squid, TinyProxy etc.) on GCE VM. Then direct your outbound scraping traffic through that proxy using appropriate routing or proxy configuration in your application. Obviously, there is some overhead associated with setting up that proxy instance(s).