Networking
VPC networking
Private networking between your compos resources.
Overview
VPC networking on compos connects your resources over a private network without exposing them to the public internet. This is useful for internal APIs, database connections, and service-to-service communication.
Setup
Enable VPC networking in your config:
networking: {
vpc: {
enabled: true,
cidr: "10.0.0.0/16",
},
}Service discovery
Resources within the same VPC can communicate using internal DNS names:
// From a function calling an internal API
const response = await fetch("http://api.internal:3000/data");Firewall rules
Control traffic between resources with firewall rules:
firewall: [
{
source: "api",
destination: "database",
port: 5432,
protocol: "tcp",
action: "allow",
},
]