Skip to content

TargetGroup

Source: src/AWS/ELBv2/TargetGroup.ts

An ELBv2 target group. A target group routes requests to one or more registered targets (instances, IPs, Lambda functions, or another ALB) using the configured protocol and port, and runs health checks against them.

HTTP target group

const tg = yield* TargetGroup("web", {
vpcId: vpc.vpcId,
port: 80,
protocol: "HTTP",
targetType: "ip",
});

gRPC target group

const tg = yield* TargetGroup("grpc", {
vpcId: vpc.vpcId,
port: 50051,
protocol: "HTTP",
protocolVersion: "GRPC",
matcher: { GrpcCode: "0" },
});
const tg = yield* TargetGroup("api", {
vpcId: vpc.vpcId,
port: 8080,
protocol: "HTTP",
healthCheckPath: "/healthz",
healthCheckIntervalSeconds: 15,
healthyThresholdCount: 3,
unhealthyThresholdCount: 3,
});