🎉 Premium Proxies · 24-Hour Free TrialClaim Now
Use Cases

Cloud Run Static Outbound IP for Proxy Whitelisting

Set a Cloud Run static outbound IP with Cloud NAT and whitelist it on your proxy, or skip NAT with user:pass auth. Commands, egress check, NAT ports and costs.

S SparkProxy 4 23 min read
Share
Cloud Run Static Outbound IP for Proxy Whitelisting

A Cloud Run static outbound IP is what you need the moment a scraper that authenticates to its proxy by IP whitelist moves from your laptop or VM onto Cloud Run and every request comes back 407 Proxy Authentication Required. Cloud Run sends outbound traffic from a shared pool of dynamic addresses, so there is nothing stable to whitelist. You have two working fixes: route egress through a VPC and Cloud NAT that owns a reserved IP, then whitelist that one address, or skip NAT entirely and authenticate with a username and password. This guide builds both, shows what each costs, and gives you a check that proves the requests really leave from the reserved IP.

The symptom on Cloud Run

The code is unchanged and the proxy works from your workstation, but the deployed service logs lines like these. We captured them on 2026-10-31 by calling gateway.sparkproxy.io:11000 from a machine whose IP was not on the account's whitelist:

curl: (56) CONNECT tunnel failed, response 407

ProxyError(MaxRetryError("HTTPSConnectionPool(host='api.ipify.org', port=443): Max retries
exceeded with url: / (Caused by ProxyError('Unable to connect to proxy',
OSError('Tunnel connection failed: 407 Proxy Authentication Required')))"))

The raw response from the gateway makes the cause explicit:

< HTTP/1.1 407 Proxy Authentication Required
< X-Squid-Error: ERR_CACHE_ACCESS_DENIED 0
< Proxy-Authenticate: Basic realm="SparkProxy"

The gateway saw a source address it did not recognise and no credentials, so it asked for credentials. On Cloud Run the source address is not yours. Google's own static outbound IP guide says Cloud Run's default egress uses a shared pool of dynamic IP addresses, and the same page warns that this pool should not be used for scanning or load testing because it degrades shared reputation. You could whitelist whatever address you see today and it will change on the next instance. Those shared addresses also sit inside Google's published ranges, which is a separate problem for target sites, covered in our explainer on cloud provider IP ranges.

A proxy can fix the second problem (the target sees the proxy exit, not Google). It cannot fix the first one on its own: something has to prove to the gateway that the request is yours, either a fixed source IP or a password.

Choose a path before you touch the network

The two paths solve the same authentication problem with very different amounts of infrastructure. If you are unsure how the gateway decides between them, our guide to how proxy authentication works walks through the 407 challenge in detail.

QuestionPath A: Cloud NAT + reserved IPPath B: user:pass, no NAT
What the gateway checksSource IP against your whitelist`Proxy-Authorization` header
Google Cloud resources addedVPC, subnet(s), Cloud Router, Cloud NAT, reserved IP, optional connectorNone (one Secret Manager secret)
Credentials in the containerNoneProxy username and password
Cold start impactPossible, see the Direct VPC note belowNone
Per-GiB cost on Google's sideNAT data processing on every scraped byteNone beyond normal egress
Works with tools that cannot send proxy credentialsYesNo

Pick Path A when something in the stack cannot send proxy credentials (a headless browser flag such as --proxy-server, a vendor binary, a legacy library), when a partner API also allowlists your callers, or when policy forbids storing proxy secrets in the workload. Pick Path B for everything else. Most HTTP clients take credentials in the proxy URL, and Path B has no network resources to maintain or pay for. The trade-offs of whitelisting itself (shared NAT addresses, slot limits) are covered in what IP whitelisting is for proxies; this guide is about doing it on Google Cloud.

Free trial

Scraping at scale? Skip the blocks.

Fast, unblockable datacentre proxies with unlimited bandwidth.

Path A, part 1: VPC, subnets, router and reserved IP

Everything below lives in one region. Google's guide asks for the NAT and the service in the same region, and a reserved regional IP can only be used by a NAT in its own region.

PROJECT=your-project-id
REGION=us-central1
gcloud config set project "$PROJECT"
gcloud services enable compute.googleapis.com run.googleapis.com vpcaccess.googleapis.com

# Custom-mode VPC with one subnet for Direct VPC egress (must be /26 or larger)
gcloud compute networks create scrape-vpc --subnet-mode=custom
gcloud compute networks subnets create scrape-run \
  --network=scrape-vpc --region="$REGION" --range=10.10.0.0/24

# A separate /28 for a Serverless VPC Access connector, if you choose one
gcloud compute networks subnets create scrape-conn \
  --network=scrape-vpc --region="$REGION" --range=10.10.1.0/28

# Cloud Router (control plane only, no extra hop) and the reserved address
gcloud compute routers create scrape-router --network=scrape-vpc --region="$REGION"
gcloud compute addresses create scrape-egress-ip --region="$REGION"
gcloud compute addresses describe scrape-egress-ip --region="$REGION" --format='value(address)'

The last command prints the address you will whitelist. Write it down now; the verification step compares against it.

Subnet sizing deserves a minute of thought. Per Google's Direct VPC docs (updated 2026-10-30), a service consumes about twice as many subnet IPs as it has instances at steady state, holds them for up to 20 minutes after scale-down, and reserves them in blocks of 16. A job task holds one IP for its run plus 7 minutes. A /26 is the documented minimum, but a scraper that fans out to a few hundred tasks will exhaust it, which is why the example uses a /24. The connector subnet is a fixed /28 and, per the connector docs, cannot be expanded after the connector exists.

Path A, part 2: the Cloud NAT gateway

The NAT is where the reserved address gets attached to your traffic. Google's minimal command is short:

gcloud compute routers nats create scrape-nat \
  --router=scrape-router --region="$REGION" \
  --nat-custom-subnet-ip-ranges=scrape-run,scrape-conn \
  --nat-external-ip-pool=scrape-egress-ip

For a scraper, add port settings and error logging on day one. The reason is in the NAT port section below; the short version is that every proxy connection goes to the same destination, and the default allocation runs out quickly.

gcloud compute routers nats update scrape-nat \
  --router=scrape-router --region="$REGION" \
  --no-enable-endpoint-independent-mapping \
  --enable-dynamic-port-allocation \
  --min-ports-per-vm=1024 --max-ports-per-vm=8192 \
  --enable-logging --log-filter=ERRORS_ONLY

Two details trip people up. First, --nat-custom-subnet-ip-ranges must list the subnet your traffic actually comes from. With a connector that is the connector's /28, not the Direct VPC subnet. A NAT that covers only scrape-run while the service uses scrape-conn gives you a service with no internet route at all. Second, always pin the IP with --nat-external-ip-pool. The alternative, auto-allocated NAT addresses, can change as Google adds or removes addresses, which defeats the point of the exercise.

Now add the address from addresses describe to the IP whitelist in your SparkProxy dashboard. Plans include 5 whitelist slots on Starter and up to 25 on Plus (sparkproxy.io pricing, read 2026-10-31), so one NAT address per region fits comfortably.

Getting traffic into the VPC: connector or Direct VPC egress

Cloud Run has two ways to send traffic into the VPC, and Google's documents disagree about which one to use with NAT. The static outbound IP guide lists Direct VPC egress first. The Direct VPC page (updated 2026-10-30) says that with Cloud NAT "you might experience cold start delays of 30s or more" and recommends Serverless VPC Access connectors with Cloud NAT for better startup performance. That conflict matters more for scrapers than for most workloads.

Serverless VPC Access connectorDirect VPC egress
Extra resourceConnector instances, billed as Compute Engine VMsNone
SubnetDedicated `/28``/26` or larger, about 2 IPs per instance
Startup with Cloud NATRecommended by Google for startup performance30 s or more possible
ScalingMin 2, max 10 instances; does not scale back inScales with the service, cost scales to zero
ThroughputEstimated 200-1000 Mbps per e2-micro instanceUp to 1 Gbps per container instance
Machine typesf1-micro, e2-micro, e2-standard-4n/a

Our rule of thumb: a request-driven service that must answer quickly (a webhook that scrapes on demand) should use a connector, because a 30-second first request is an outage from the caller's point of view. A Cloud Run job that runs a batch every hour can absorb a slow start and benefits from not paying for idle connector VMs. Whichever you pick, Google's Direct VPC page recommends an HTTP startup probe that tests egress connectivity, so an instance that has not got a route yet never receives traffic.

The connector's no-scale-in rule has a cost edge. The connector docs say plainly that connectors "don't scale in": if a backlog pushes it to 10 instances, it stays at 10, and you are billed for 10 VMs until you recreate it. Set --max-instances deliberately rather than taking the default of 10.

gcloud compute networks vpc-access connectors create scrape-conn \
  --region="$REGION" --subnet=scrape-conn \
  --min-instances=2 --max-instances=3 --machine-type=e2-micro

Deploying services, jobs and functions with all-traffic egress

The single most common Path A mistake is leaving egress at its default. For gcloud run deploy and gcloud run jobs deploy, --vpc-egress defaults to private-ranges-only, which sends only RFC 1918 and Private Google Access traffic into the VPC. The proxy gateway has a public address, so its traffic skips the VPC, skips the NAT, and leaves from the shared pool. The deploy succeeds, nothing errors, and you get 407s. Set all-traffic explicitly:

# Service through the connector
gcloud run deploy scraper --image="$REGION-docker.pkg.dev/$PROJECT/scrape/scraper:1" \
  --region="$REGION" --vpc-connector=scrape-conn --vpc-egress=all-traffic

# Service with Direct VPC egress instead
gcloud run deploy scraper --image="$REGION-docker.pkg.dev/$PROJECT/scrape/scraper:1" \
  --region="$REGION" --network=scrape-vpc --subnet=scrape-run --vpc-egress=all-traffic

# Batch job: 20 shards, at most 10 running at once
gcloud run jobs deploy scrape-batch --image="$REGION-docker.pkg.dev/$PROJECT/scrape/worker:1" \
  --region="$REGION" --tasks=20 --parallelism=10 --max-retries=2 --task-timeout=1800 \
  --vpc-connector=scrape-conn --vpc-egress=all-traffic

Functions use a different flag name for the same switch. In gcloud functions deploy the values are private-ranges-only and all:

gcloud functions deploy fetch-prices --gen2 --region="$REGION" \
  --runtime=python312 --source=. --entry-point=main --trigger-http \
  --vpc-connector=scrape-conn --egress-settings=all

Note also that --vpc-egress=all still exists on gcloud run jobs deploy but is marked deprecated in the gcloud reference; use all-traffic there.

Proving requests leave from the reserved IP

Do not whitelist and hope. Deploy a small probe that asks an IP echo service for its view of you twice, once directly and once through the gateway with no credentials. Google's static IP guide uses curlmyip.org for this check, which returns the caller's address as plain text.

import json
import os
from http.server import BaseHTTPRequestHandler, HTTPServer

import requests

ECHO = "https://curlmyip.org"
GATEWAY = "http://gateway.sparkproxy.io:11000"  # no credentials on purpose


def probe():
    s = requests.Session()
    s.trust_env = False  # ignore any HTTPS_PROXY in the environment
    result = {"expected": os.environ.get("EXPECTED_EGRESS_IP", "")}
    result["direct"] = s.get(ECHO, timeout=10).text.strip()
    try:
        r = s.get(ECHO, proxies={"http": GATEWAY, "https": GATEWAY}, timeout=20)
        result["proxy_exit"] = r.text.strip()
    except requests.exceptions.ProxyError as exc:
        result["proxy_exit"] = None
        result["proxy_error"] = str(exc)[-90:]
    result["ok"] = (
        result["direct"] == result["expected"]
        and bool(result["proxy_exit"])
        and result["proxy_exit"] != result["direct"]
    )
    return result


class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        body = json.dumps(probe()).encode()
        self.send_response(200 if json.loads(body)["ok"] else 500)
        self.send_header("Content-Type", "application/json")
        self.end_headers()
        self.wfile.write(body)


if __name__ == "__main__":
    HTTPServer(("", int(os.environ.get("PORT", "8080"))), Handler).serve_forever()

Deploy it with the same network flags as the real service plus --set-env-vars=EXPECTED_EGRESS_IP=, then call it. The three fields tell you which layer is wrong:

`direct``proxy_exit`Meaning
Reserved IPA different IPPath A works: NAT is in the path and the whitelist accepted it
Reserved IP`null`, 407 in `proxy_error`NAT is fine; the whitelist entry is missing or has a typo
Some other Google IP`null`, 407Traffic is not going through the NAT (egress setting or NAT subnet list)
Request times outn/aTraffic enters the VPC but has no route out: NAT missing or not covering the subnet

On the Google side, gcloud compute routers get-nat-ip-info scrape-router --region="$REGION" shows which NAT addresses are in use, and the NAT error logs you enabled earlier show dropped connections. Keep the probe deployed as a scheduled health check; a teammate who "tidies up" the NAT config will find out from it rather than from a failed overnight run.

The NAT port ceiling that proxy traffic hits first

This is the part most static-IP tutorials skip, and it hits proxy users harder than anyone. Cloud NAT gives each NAT IP 64,512 TCP source ports, and each VM using the gateway gets a minimum allocation: 64 ports by default with static allocation, per the gcloud reference. The ports doc states how many simultaneous connections that buys: one per allocated port for each unique destination, where a destination is the 3-tuple of IP, port and protocol.

A normal crawler talks to hundreds of destinations, so 64 ports per destination is rarely the limit. A proxied scraper talks to exactly one. When we resolved gateway.sparkproxy.io on 2026-10-31 it returned a single A record, so every connection to port 11000 shares one 3-tuple. Each VM behind the NAT (for a connector, each connector instance) can therefore hold only as many open proxy connections as it has ports, and closed connections keep their port unavailable through TCP TIME_WAIT. Google's static IP page names the same risk and the same remedies: add static IPs, raise minimum ports per instance, or enable dynamic port allocation.

What it looks like when you hit it: connection timeouts and resets to the gateway under load, never a 407. The authoritative signal is the metric router.googleapis.com/nat/dropped_sent_packets_count with the reason label set to OUT_OF_RESOURCES, which the monitoring doc defines as Cloud NAT running out of NAT IP addresses or ports. nat/port_usage reports the maximum connections from one VM to a single endpoint, which is exactly your proxy connection count.

Size it from your plan. A Starter plan allows 100 threads, so 100 concurrent proxy connections across the fleet is the real ceiling; with two connector instances, 1,024 minimum ports each leaves plenty of room for TIME_WAIT churn. Dynamic port allocation (enabled in the update command above) doubles a VM's allocation as it nears the limit, up to --max-ports-per-vm. The ports doc notes that endpoint-independent mapping requires static allocation, which is why the update command disables it.

Path B: user:pass from Secret Manager, no NAT

If nothing in your stack needs a fixed source IP, this path is shorter, cheaper and has no cold start penalty. The service keeps Cloud Run's default egress, and the gateway authenticates the request by its Proxy-Authorization header instead of its address.

Store the password in Secret Manager and expose it as an environment variable. Cloud Run resolves environment-variable secrets at instance startup, and its secrets page recommends pinning a version number rather than latest for that reason:

printf '%s' 'YOUR_PROXY_PASSWORD' | gcloud secrets create sparkproxy-pass --data-file=-
gcloud secrets add-iam-policy-binding sparkproxy-pass \
  --member="serviceAccount:scraper-sa@$PROJECT.iam.gserviceaccount.com" \
  --role=roles/secretmanager.secretAccessor
gcloud run deploy scraper --image="$REGION-docker.pkg.dev/$PROJECT/scrape/scraper:1" \
  --region="$REGION" --service-account="scraper-sa@$PROJECT.iam.gserviceaccount.com" \
  --set-env-vars=PROXY_USER=YOUR_PROXY_USER --update-secrets=PROXY_PASS=sparkproxy-pass:1

If the secret cannot be read, the instance does not start, which is a better failure than a fleet of 407s. In the code, build the proxy URL explicitly and percent-encode both parts:

import os
import urllib.parse

import requests

GATEWAY = "gateway.sparkproxy.io"
PORTS = {"rotate": 11000, "sticky": 11002}


def proxied_session(mode="rotate"):
    user = urllib.parse.quote(os.environ["PROXY_USER"], safe="")
    pwd = urllib.parse.quote(os.environ["PROXY_PASS"], safe="")
    url = f"http://{user}:{pwd}@{GATEWAY}:{PORTS[mode]}"
    s = requests.Session()
    s.trust_env = False
    s.proxies = {"http": url, "https": url}
    return s


def fetch(url, mode="rotate"):
    with proxied_session(mode) as s:
        r = s.get(url, timeout=(5, 30))
        return r.status_code, r.text

Setting trust_env = False and passing proxies per session, rather than exporting HTTPS_PROXY for the whole container, keeps calls to Cloud Storage, Secret Manager and other Google APIs off the proxy. The same Path B setup works unchanged in Cloud Run functions.

Concurrency, rotation and scheduling for a scrape job

Either path ends in the same pipeline: Cloud Scheduler triggers a Cloud Run job, the job splits a URL list across tasks, and each task writes raw pages to Cloud Storage. Google's scheduling page gives the trigger:

gcloud scheduler jobs create http scrape-hourly --location="$REGION" \
  --schedule="0 * * * *" \
  --uri="https://run.googleapis.com/v2/projects/$PROJECT/locations/$REGION/jobs/scrape-batch:run" \
  --http-method=POST \
  --oauth-service-account-email="scheduler-sa@$PROJECT.iam.gserviceaccount.com"

Each task reads CLOUD_RUN_TASK_INDEX and CLOUD_RUN_TASK_COUNT, which Cloud Run sets for every job task, and takes its slice:

import concurrent.futures as cf
import hashlib
import os

from google.cloud import storage

from scraper import fetch  # the Path B helper above, or a no-auth session for Path A

BUCKET = os.environ["RAW_BUCKET"]
WORKERS = int(os.environ.get("WORKERS", "8"))


def my_slice(urls):
    idx = int(os.environ.get("CLOUD_RUN_TASK_INDEX", "0"))
    count = int(os.environ.get("CLOUD_RUN_TASK_COUNT", "1"))
    return urls[idx::count]


def save(bucket, url, html):
    key = "raw/" + hashlib.sha256(url.encode()).hexdigest() + ".html"
    bucket.blob(key).upload_from_string(html, content_type="text/html")


def main():
    bucket = storage.Client().bucket(BUCKET)
    with open("urls.txt", encoding="utf-8") as f:
        urls = my_slice([line.strip() for line in f if line.strip()])
    failed = []
    with cf.ThreadPoolExecutor(max_workers=WORKERS) as pool:
        futures = {pool.submit(fetch, u): u for u in urls}
        for fut in cf.as_completed(futures):
            url = futures[fut]
            try:
                status, html = fut.result()
                if status == 200:
                    save(bucket, url, html)
                else:
                    failed.append(url)
            except Exception:
                failed.append(url)
    if len(failed) > len(urls) // 4:
        raise SystemExit(f"{len(failed)} of {len(urls)} failed")  # lets --max-retries rerun the task


if __name__ == "__main__":
    main()

The number that must line up with your proxy plan is total open connections: parallelism × WORKERS for a job, or max instances × concurrency for a service. Cloud Run's concurrency defaults to 80 requests per instance per vCPU when deployed with gcloud, with a maximum of 1,000, so an unthrottled service can open far more proxy connections than a 100-thread plan allows. With --parallelism=10 and WORKERS=8 the job above holds 80 connections, inside a Starter allowance. Our guide on concurrent connections in proxies explains what happens when you exceed it.

For rotation, port 11000 gives Random Rotation (a new exit per connection) and suits independent product or listing URLs. Port 11002 gives Sticky Sessions, which hold one exit for up to five minutes and suit paginated flows or anything with a cookie; the mechanics are in what a sticky session proxy is. The SparkProxy pool covers 80+ countries, so a job can pin geography per task if the targets are regional.

If keeping a browser or proxy pool alive is more than the job deserves, the SparkProxy Scraping API replaces both with an API key in the X-API-Key header, and the key needs neither NAT nor whitelisting. render_js defaults to true at 5 credits; render_js=false is a plain fetch at 1 credit. With json_response=true the response is an envelope whose body is base64:

import base64
import os

import requests


def scrape(url, render_js=False):
    r = requests.get(
        "https://scrape.sparkproxy.io/api/v1",
        params={"url": url, "render_js": str(render_js).lower(), "json_response": "true"},
        headers={"X-API-Key": os.environ["SPARK_API_KEY"]},
        timeout=240,
    )
    r.raise_for_status()
    env = r.json()
    html = base64.b64decode(env["body"]).decode("utf-8", "replace")  # decode before matching
    return env["status_code"], env["credits_used"], html

What each path costs per month

Prices below are USD, from Google's Cloud NAT and network pricing pages read on 2026-10-31, using 730 hours per month (Google's own examples use 720).

Line itemRateMonthly
NAT gateway uptime$0.0014/hour per VM instance using it, capped at $0.044/hour above 32$1.02 per VM; at most $32.12
External IP used by NAT$0.005/hour$3.65
NAT data processing$0.045 per GiB, inbound and outbound$13.50 per 300 GiB
Reserved IP not attached to anything$0.01/hour$7.30 (avoid by deleting unused addresses)
Connector instances (connector only)Billed as Compute Engine VMs of the chosen type, minimum 2Check your region's shared-core rate

The NAT pricing page counts VM instances that receive a NAT assignment. For a connector, those are the connector's instances. The page does not say how Direct VPC egress instances are counted, so budget for the $32.12 cap if you use it at scale.

A worked month for Path A with a 2-instance connector and 300 GiB of scraped pages: $2.04 gateway + $3.65 IP + $13.50 processing = about $19.19, plus the two connector VMs. At 2 TiB (2,048 GiB) the processing line alone is $92.16. The data processing charge is the line that scales, and it scales with page weight: rendered pages, images and retries all pass through the NAT twice (request out, response in), and both directions are billed.

The proxy side does not scale that way. SparkProxy plans are packs priced by threads with unlimited bandwidth, starting from $75/month for 100 threads (Core is $140 for 250, Boost $240 for 500, Plus $440 for 1,000; prices exclude VAT/GST; 3-, 6- and 12-month terms save 5%, 10% and 15%; read 2026-10-31). So on Path A the NAT, not the proxy, becomes your only per-GiB bill. Path B removes the NAT, IP and connector lines completely, which is why it is our default recommendation unless something forces a fixed IP. There is a 24-hour free trial with no credit card if you want to run the probe above before committing.

When the whitelist still rejects you

Work from the cheapest check down. Each row names whether a proxy change can fix it.

  1. Is the request going through the NAT at all? Run the probe. If direct is not the reserved IP, the problem is Google-side routing.
  2. Is the whitelisted string the same as the reserved IP? Copy it from gcloud compute addresses describe, not from a screenshot.
  3. Are there more egress IPs than whitelist entries? A second region, a second NAT address added for port capacity, or a staging project each need their own slot.
  4. Is it really authentication? A timeout or reset is not a 407 and points at NAT ports or a missing route.
What you seeCauseFixable on the proxy side?
407, `direct` is a non-reserved Google IP`--vpc-egress` left at `private-ranges-only`, or `--egress-settings` not `all`No, redeploy with all-traffic egress
407, `direct` is the reserved IPWhitelist entry missing, mistyped, or in another accountYes, fix the whitelist entry
407 only from one region or projectThat region's NAT IP was never whitelistedYes, add the address
Timeouts on every external call after enabling VPCNAT absent or not covering the connector or Direct VPC subnetNo, fix `--nat-custom-subnet-ip-ranges`
First request after deploy takes 30 s or moreDirect VPC egress with Cloud NAT cold startNo, use a connector or a startup probe
Resets and timeouts only under loadNAT port exhaustion, `OUT_OF_RESOURCES` dropsNo, raise ports or add NAT IPs
200 from the tunnel, 403 or CAPTCHA from the siteTarget blocks the exit or the fingerprintPartly: change rotation mode, country or pacing

The last row is a different problem from this guide. The NAT address only identifies you to the gateway; the target sees the proxy exit. If the target still refuses, the fix lives in request pacing, Sticky Sessions for stateful flows, or a rendered fetch, not in Cloud Run networking.

Frequently asked questions

FAQ

No. Google's documentation says Cloud Run's default outbound traffic uses a shared pool of dynamic IP addresses. To get a Cloud Run static outbound IP you route egress through a VPC with --vpc-egress=all-traffic and attach a reserved address to a Cloud NAT gateway.

Reserve a regional address with gcloud compute addresses create, attach it to Cloud NAT with --nat-external-ip-pool, deploy the service with a connector or Direct VPC egress and all-traffic egress, then add that address to the proxy dashboard's IP whitelist. Confirm with an IP echo call that the service's direct egress matches the reserved address.

Only if you authenticate by IP. With username and password authentication the service can keep Cloud Run's default egress, store the password in Secret Manager, and pass it in the proxy URL, with no VPC, NAT or reserved IP to pay for.

Google's Direct VPC page warns of cold start delays of 30 seconds or more with Cloud NAT and recommends connectors for better startup performance. Use a connector for latency-sensitive services and consider Direct VPC egress for batch jobs, where a slow start matters less and there are no idle connector VMs to pay for.

On Google's prices read 2026-10-31 (USD), the NAT IP is $3.65 a month, the gateway is $0.0014 per hour per VM instance using it (capped at $0.044 per hour), and every GiB through the NAT costs $0.045. A connector adds at least two Compute Engine VMs; the worked example in this guide (two connector instances, 300 GiB) comes to about $19 a month plus those VMs.

Most often the service still uses private-ranges-only egress, so traffic to the public proxy gateway bypasses the NAT and leaves from Google's shared pool. Check that the direct egress IP equals the reserved address; if it does, the whitelist entry itself is wrong or missing.

Special Discount · 20% off

Get 20% off your first month

Premium datacentre proxies with unlimited bandwidth. Use the code at checkout.

Save up to 15% more on quarterly, half-yearly and yearly plans

Claim Discount

About the Author

The SparkProxy Technical Team runs SparkProxy's proxy network, with 1M+ premium IPs across 80+ countries over HTTP, HTTPS and SOCKS5 through gateway.sparkproxy.io, IP whitelist or user:pass authentication on every plan, and the SparkProxy Scraping API at scrape.sparkproxy.io. We write these guides from the support conversations engineers start when a scraper that worked on a VM stops authenticating on serverless platforms. Questions go to support@sparkproxy.io.

Keep reading

Related articles