Skip to content

LoadBalancer

Source: src/AWS/ELBv2/LoadBalancer.ts

An ELBv2 (Application / Network / Gateway) load balancer.

Internet-facing Application Load Balancer

const lb = yield* LoadBalancer("web", {
type: "application",
scheme: "internet-facing",
subnets: [subnet1.subnetId, subnet2.subnetId],
securityGroups: [sg.groupId],
});

Network Load Balancer with static EIPs

const nlb = yield* LoadBalancer("edge", {
type: "network",
scheme: "internet-facing",
subnetMappings: [
{ subnetId: subnet1.subnetId, allocationId: eip1.allocationId },
{ subnetId: subnet2.subnetId, allocationId: eip2.allocationId },
],
});
const lb = yield* LoadBalancer("web", {
type: "application",
subnets: [subnet1.subnetId, subnet2.subnetId],
attributes: {
"idle_timeout.timeout_seconds": "120",
"deletion_protection.enabled": "true",
},
});