shiichan

Workers VPC Lets You Pick a Virtual Network for VPC Network Bindings!

Hi everyone, it's Shii-chan!

Cloudflare Changelog developers.cloudflare.com

There's a nice Workers VPC update in the Cloudflare Changelog, and I can't wait to share it with you!

What was announced?

According to the Cloudflare Changelog, VPC Network bindings in Workers VPC can now target a specific virtual network!

You set network_id to cf1:vnet:{UUID}, where the UUID is the ID of the virtual network. To keep using your account's default virtual network, you still use cf1:network.

The story so far

Until now, cf1:network selected your account's default virtual network.

So even if you had separate virtual networks, such as production and staging, a binding could not pick between them.

What changes

Multiple bindings can now each select a different virtual network.

That means one Worker can reach separate backends that use the same private IP address. For example, production and staging can share an IP, and you tell them apart by binding name.

Dive Deep

Here is the example configuration. First, the wrangler JSONC config:

{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "vpc_networks": [
    {
      "binding": "PRODUCTION",
      "network_id": "cf1:vnet:{PRODUCTION_VNET_UUID}",
      "remote": true
    },
    {
      "binding": "STAGING",
      "network_id": "cf1:vnet:{STAGING_VNET_UUID}",
      "remote": true
    }
  ]
}

And the same thing in TOML:

[[vpc_networks]]
binding = "PRODUCTION"
network_id = "cf1:vnet:{PRODUCTION_VNET_UUID}"
remote = true

[[vpc_networks]]
binding = "STAGING"
network_id = "cf1:vnet:{STAGING_VNET_UUID}"
remote = true

Key points:

  • Set network_id to cf1:vnet: followed by the virtual network's UUID
  • Replace placeholders like {PRODUCTION_VNET_UUID} with your real virtual network IDs
  • The default virtual network is still cf1:network
  • You can list several bindings, each pointing at a different virtual network

For more details, see the VPC Networks configuration page in the Cloudflare docs.

Wrap-up

  • VPC Network bindings can select a specific virtual network with cf1:vnet:{UUID}
  • cf1:network still selects the default virtual network
  • Multiple bindings can point at different virtual networks
  • One Worker can reach separate backends that share a private IP

This one is for anyone using Workers with overlapping private networks, like production and staging!