Skip to content

Network

Source: src/AWS/EC2/Network.ts

Creates a production-shaped VPC network from the low-level EC2 primitives.

Network is the ergonomic entry point for users who want a ready-to-use VPC layout without manually creating route tables, internet gateways, NAT gateways, and subnet associations by hand.

The helper still returns the underlying canonical resources so callers can keep composing with raw AWS.EC2.* APIs when they need more control.

Minimal network

const network = yield* AWS.EC2.Network("AppNetwork", {
cidrBlock: "10.42.0.0/16",
});

ECS-ready network with shared NAT

const network = yield* AWS.EC2.Network("AppNetwork", {
cidrBlock: "10.42.0.0/16",
availabilityZones: 2,
nat: "single",
gatewayEndpoints: ["s3"],
});
yield* AWS.ECS.Service("ApiService", {
cluster,
task: apiTask,
vpcId: network.vpcId,
subnets: network.publicSubnetIds,
assignPublicIp: true,
});