Skip to content

Listener

Source: src/AWS/VpcLattice/Listener.ts

An Amazon VPC Lattice listener — the process on a lattice service that checks for connection requests on a protocol/port and routes them via its default action and rules.

HTTP Listener with a Fixed Default Response

const listener = yield* Listener("HttpListener", {
serviceIdentifier: service.serviceId,
protocol: "HTTP",
port: 80,
defaultAction: { fixedResponse: { statusCode: 404 } },
});

Listener Forwarding to a Target Group

const listener = yield* Listener("ApiListener", {
serviceIdentifier: service.serviceId,
protocol: "HTTP",
defaultAction: {
forward: {
targetGroups: [
{ targetGroupIdentifier: targets.targetGroupId, weight: 100 },
],
},
},
});