Hyperdrive support for private databases with Workers VPC
Key Points
- Connect Hyperdrive to private DBs
- Dashboard or wrangler CLI setup
- Reusable Workers VPC across products
Summary
Cloudflare Hyperdrive can now connect to private databases using a Workers VPC service. This is the recommended method for accessing databases that are not exposed to the public Internet. You can configure the connection from the Cloudflare dashboard or via the wrangler CLI.
Key Points
- Recommended approach for private databases: choose "Connect to private database" → "Workers VPC" in the dashboard and select or create a VPC service.
- When creating inline, specify a Cloudflare Tunnel and the origin host and TCP port for your database.
- CLI example to create a VPC-backed Hyperdrive config:
npx wrangler hyperdrive create my-vpc-database --service-id <YOUR_VPC_SERVICE_ID> --database <DATABASE_NAME> --user <DATABASE_USER> --password <DATABASE_PASSWORD> --scheme postgresql
- Workers VPC services are reusable across Hyperdrive configurations and can be bound directly to Workers, allowing the same private connection to be shared across products.