Skip to content

GCP.ServiceNetworking reference

Source: packages/gcp/src/ServiceNetworking/Connection.ts

A private services access connection (VPC Network Peering to a Google or third-party service producer).

The API has no labels or description. Alchemy treats existence at (network, service) as ownership. list returns connections whose consumer VPC carries Alchemy ownership markers so pnpm nuke:gcp can still clean leaks.

network and service are immutable. reservedPeeringRanges update in place.

Private services access on a VPC

const network = yield* GCP.Compute.Network("Vpc", {
autoCreateSubnetworks: false,
});
const range = yield* GCP.Compute.GlobalAddress("PsaRange", {
addressType: "INTERNAL",
purpose: "VPC_PEERING",
network: network.selfLink,
prefixLength: 24,
});
const connection = yield* GCP.ServiceNetworking.Connection("Psa", {
network: network.networkName,
reservedPeeringRanges: [range.addressName],
});

Explicit service and additional ranges

const connection = yield* GCP.ServiceNetworking.Connection("Psa", {
network: network.networkName,
service: "servicenetworking.googleapis.com",
reservedPeeringRanges: [range.addressName, extra.addressName],
});

Connection: Looking up an existing connection

Section titled “Connection: Looking up an existing connection”

Connection.lookup references a connection Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared connection.

const connection = GCP.ServiceNetworking.Connection.lookup({
network: "my-network",
});