Skip to content

Commit 6171589

Browse files
committed
workers vpc docs pass 2
1 parent 838fd98 commit 6171589

File tree

16 files changed

+1256
-71
lines changed

16 files changed

+1256
-71
lines changed

src/content/changelog/workers-vpc/2025-08-05-workers-vpc.mdx

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Workers VPC Private Network Services (Beta)
3+
description: Access private resources in your VPC from Cloudflare Workers
4+
date: 2025-09-25T01:00:00Z
5+
---
6+
7+
We're excited to announce the beta release of **Workers VPC Private Network Services**, enabling Cloudflare Workers to securely access resources in your private networks across AWS, Azure, GCP, and on-premise infrastructure.
8+
9+
## What's new
10+
11+
- **Private Network Services**: Create secure connections to internal APIs, databases, and services that aren't exposed to the public internet
12+
- **Service Bindings**: Access private resources using familiar Worker binding syntax
13+
- **Multi-cloud Support**: Connect to resources across major cloud providers with platform-specific setup guides
14+
- **Cloudflare Tunnel Integration**: Leverage existing tunnel infrastructure for secure, outbound-only connections
15+
16+
## Getting started
17+
18+
1. Set up a Cloudflare Tunnel in your private network
19+
2. Create a Private Network Service using Wrangler
20+
3. Add the service binding to your Worker configuration
21+
4. Access your private resources securely from Workers
22+
23+
[Read the documentation](/workers-vpc/) to learn more and get started.
24+
25+
## Beta limitations
26+
27+
During the beta period:
28+
- Only HTTP/HTTPS protocols are supported (TCP support coming soon)
29+
- Maximum 100 Private Network Services per account
30+
- Maximum 10 service bindings per Worker
31+
- Available on paid Workers plans only
32+
33+
## Feedback
34+
35+
We'd love to hear your feedback on Workers VPC. Please share your experience and feature requests in the [Cloudflare Community](https://community.cloudflare.com/).
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
title: Workers Binding API
3+
pcx_content_type: reference
4+
sidebar:
5+
order: 4
6+
---
7+
8+
import { Tabs, TabItem, Render } from "~/components";
9+
10+
VPC Service bindings provide a convenient API for accessing VPC Services from your Worker. Each binding represents a connection to a service in your private network through a Cloudflare Tunnel.
11+
12+
Each request made on the binding will route to the specific service that was configured for the VPC Service, while restricting access to the rest of your private network.
13+
14+
:::note
15+
16+
Workers VPC is currently in beta. Features and APIs may change before general availability. During the beta, Workers VPC is available for free to all Workers plans.
17+
18+
:::
19+
20+
## VPC Service binding
21+
22+
A VPC Service binding is accessed via the `env` parameter in your Worker's fetch handler. It provides a `fetch()` method for making HTTP requests to your private service.
23+
24+
## fetch()
25+
26+
Makes an HTTP request to the private service through the configured tunnel.
27+
28+
```javascript
29+
const response = await env.VPC_SERVICE_BINDING.fetch(url, options);
30+
```
31+
32+
### Parameters
33+
34+
- `url` (string | URL | Request) - The URL to fetch. This must be an absolute URL including protocol, host, and path (for example, `http://internal-api:8080/api/users`)
35+
- `options` (optional RequestInit) - Standard fetch options including:
36+
- `method` - HTTP method (GET, POST, PUT, DELETE, etc.)
37+
- `headers` - Request headers
38+
- `body` - Request body
39+
- `signal` - AbortSignal for request cancellation
40+
41+
:::note[Absolute URLs Required]
42+
VPC Service fetch requests must use absolute URLs including the protocol (http/https), host, and path. Relative paths are not supported.
43+
:::
44+
45+
### Return value
46+
47+
Returns a `Promise<Response>` that resolves to a standard Fetch API Response object.
48+
49+
### Examples
50+
51+
#### Basic GET request
52+
53+
```javascript
54+
export default {
55+
async fetch(request, env) {
56+
const privateRequest = new Request(
57+
"http://internal-api.company.local/users",
58+
);
59+
const response = await env.VPC_SERVICE_BINDING.fetch(privateRequest);
60+
const users = await response.json();
61+
62+
return new Response(JSON.stringify(users), {
63+
headers: { "Content-Type": "application/json" },
64+
});
65+
},
66+
};
67+
```
68+
69+
#### POST request with body
70+
71+
```javascript
72+
export default {
73+
async fetch(request, env) {
74+
const privateRequest = new Request(
75+
"http://internal-api.company.local:8080/users",
76+
{
77+
method: "POST",
78+
headers: {
79+
"Content-Type": "application/json",
80+
Authorization: `Bearer ${env.API_TOKEN}`,
81+
},
82+
body: JSON.stringify({
83+
name: "John Doe",
84+
85+
}),
86+
},
87+
);
88+
89+
const response = await env.VPC_SERVICE_BINDING.fetch(privateRequest);
90+
91+
if (!response.ok) {
92+
return new Response("Failed to create user", { status: response.status });
93+
}
94+
95+
const user = await response.json();
96+
return new Response(JSON.stringify(user), {
97+
headers: { "Content-Type": "application/json" },
98+
});
99+
},
100+
};
101+
```
102+
103+
#### Request with HTTPS and IP address
104+
105+
```javascript
106+
export default {
107+
async fetch(request, env) {
108+
const privateRequest = new Request("https://10.0.1.50:8443/api/data");
109+
const response = await env.VPC_SERVICE_BINDING.fetch(privateRequest);
110+
111+
return response;
112+
},
113+
};
114+
```
115+
116+
## Next steps
117+
118+
- Configure [service bindings in wrangler.toml](/workers-vpc/configuration/vpc-services/)
119+
- View [usage examples](/workers-vpc/examples/)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Features
2+
title: Configuration
33
pcx_content_type: navigation
44
sidebar:
55
group:
66
hideIndex: true
7-
order: 5
7+
order: 3
88
---
99

1010
import { DirectoryListing } from "~/components";
1111

12-
<DirectoryListing />
12+
<DirectoryListing />
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Hardware requirements
3+
pcx_content_type: concept
4+
sidebar:
5+
order: 3
6+
---
7+
8+
import { TunnelCalculator } from "~/components";
9+
10+
## Recommendations
11+
12+
For production use cases, we recommend the following baseline configuration:
13+
14+
- Run a cloudflared replica on two dedicated host machines per network location. Using two hosts enables server-side redundancy and traffic balancing.
15+
- Size each host with minimum 4GB of RAM and 4 CPU cores.
16+
17+
This setup is usually sufficient to handle traffic from small-medium sized applications. The actual amount of resources used by cloudflared will depend on many variables, including the number of requests per second, bandwidth, network path and hardware. As additional users are onboarded, or if network traffic increases beyond your existing tunnel capacity, you can scale your tunnel by adding an additional cloudflared host in that location.
18+
19+
## Capacity calculator
20+
21+
Use the calculator below to estimate tunnel capacity requirements for your deployment:
22+
23+
<TunnelCalculator />
24+
25+
## Scaling considerations
26+
27+
Monitor tunnel performance and scale accordingly:
28+
29+
- **CPU utilization**: Keep below 70% average usage
30+
- **Memory usage**: Maintain headroom for traffic spikes
31+
- **Network bandwidth**: Ensure adequate throughput for peak loads
32+
- **Connection count**: Add replicas when approaching capacity limits
33+
34+
## Next steps
35+
36+
- Configure [tunnel deployment](/workers-vpc/configuration/tunnel/)
37+
- Set up [high availability](/workers-vpc/configuration/tunnel/) with multiple replicas
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
title: Cloudflare Tunnel
3+
pcx_content_type: concept
4+
sidebar:
5+
order: 2
6+
---
7+
8+
import { GlossaryTooltip, Tabs, TabItem, Example } from "~/components";
9+
10+
Cloudflare Tunnel creates secure connections from your infrastructure to Cloudflare's global network, providing the network connectivity that allows Workers to access your private resources.
11+
12+
When you create a VPC Service, you specify a tunnel ID and target service. Workers VPC then routes requests from your Worker to the appropriate tunnel, forwards traffic to your private network, connects to the specified hostname or IP address, and returns responses back to your Worker.
13+
14+
The tunnel maintains persistent connections to Cloudflare, eliminating the need for inbound firewall rules or public IP addresses.
15+
16+
:::note
17+
This section provides tunnel configuration specific to Workers VPC use cases. For comprehensive tunnel documentation including monitoring and advanced configurations, refer to the [full Cloudflare Tunnel documentation](/cloudflare-one/connections/connect-networks/).
18+
:::
19+
20+
## Quick setup
21+
22+
### Install cloudflared
23+
24+
<Tabs>
25+
<TabItem label="Linux">
26+
27+
```sh
28+
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o cloudflared
29+
chmod +x cloudflared
30+
sudo mv cloudflared /usr/local/bin/
31+
```
32+
33+
</TabItem>
34+
<TabItem label="macOS">
35+
36+
```sh
37+
brew install cloudflared
38+
```
39+
40+
</TabItem>
41+
<TabItem label="Windows">
42+
43+
```powershell
44+
choco install cloudflared
45+
```
46+
47+
</TabItem>
48+
<TabItem label="Docker">
49+
50+
```sh
51+
docker pull cloudflare/cloudflared:latest
52+
```
53+
54+
</TabItem>
55+
</Tabs>
56+
57+
### Create and run tunnel
58+
59+
Authenticate with Cloudflare, create your tunnel, and run it with a basic configuration that routes all traffic to your local services:
60+
61+
```sh
62+
cloudflared tunnel login
63+
cloudflared tunnel create workers-vpc-tunnel
64+
```
65+
66+
Create `~/.cloudflared/config.yml` with your tunnel configuration:
67+
68+
```yaml
69+
tunnel: <YOUR_TUNNEL_ID>
70+
credentials-file: /home/user/.cloudflared/<YOUR_TUNNEL_ID>.json
71+
72+
ingress:
73+
- hostname: "*"
74+
service: http://localhost:8080
75+
originRequest:
76+
noTLSVerify: true
77+
- service: http_status:404
78+
```
79+
80+
Start the tunnel:
81+
82+
```sh
83+
cloudflared tunnel run workers-vpc-tunnel
84+
```
85+
86+
## Cloud platform setup guides
87+
88+
For platform-specific tunnel deployment instructions for production workloads:
89+
90+
- [AWS](/cloudflare-one/connections/connect-networks/deployment-guides/aws/) - Deploy tunnels in Amazon Web Services
91+
- [Azure](/cloudflare-one/connections/connect-networks/deployment-guides/azure/) - Deploy tunnels in Microsoft Azure
92+
- [Google Cloud](/cloudflare-one/connections/connect-networks/deployment-guides/google-cloud-platform/) - Deploy tunnels in Google Cloud Platform
93+
- [Kubernetes](/cloudflare-one/connections/connect-networks/deployment-guides/kubernetes/) - Deploy tunnels in Kubernetes clusters
94+
- [Terraform](/cloudflare-one/connections/connect-networks/deployment-guides/terraform/) - Deploy tunnels using Infrastructure as Code
95+
96+
Refer to the full Cloudflare Tunnel documentation on [how to setup Tunnels for high availability and failover with replicas](/cloudflare-one/connections/connect-networks/configure-tunnels/tunnel-availability/).
97+
98+
## Next steps
99+
100+
- Configure [VPC Services](/workers-vpc/configuration/vpc-services/) to connect your tunnels to Workers
101+
- Review [hardware requirements](/workers-vpc/configuration/tunnel/hardware-requirements/) for capacity planning
102+
- Review the [complete Cloudflare Tunnel documentation](/cloudflare-one/connections/connect-networks/) for advanced features

0 commit comments

Comments
 (0)