Rule
Source:
src/AWS/VpcLattice/Rule.ts
An Amazon VPC Lattice listener rule — matches HTTP requests by method, path, or headers and forwards them to target groups (or answers with a fixed response), evaluated in priority order before the listener’s default action.
Creating Rules
Section titled “Creating Rules”Path-Prefix Rule Forwarding to a Target Group
const rule = yield* Rule("ApiRule", { serviceIdentifier: service.serviceId, listenerIdentifier: listener.listenerId, priority: 10, match: { httpMatch: { pathMatch: { match: { prefix: "/api" } } } }, action: { forward: { targetGroups: [ { targetGroupIdentifier: targets.targetGroupId, weight: 100 }, ], }, },});Method Match with a Fixed Response
const rule = yield* Rule("BlockDeletes", { serviceIdentifier: service.serviceId, listenerIdentifier: listener.listenerId, priority: 1, match: { httpMatch: { method: "DELETE" } }, action: { fixedResponse: { statusCode: 403 } },});