Skip to content

ALBRequestContext

reference
1 min readUpdated

Kind: Interface

Source: src/adapter/aws-lambda/types.ts

Part of: Adapter

ALBRequestContext describes the Application Load Balancer metadata attached to a request handled by the AWS Lambda adapter. Its elb.targetGroupArn field identifies the ALB target group that routed the request.

Properties

PropertyType
elb{ targetGroupArn: string }

Diagram

mermaid
graph LR
  Request[ALB Request] --> Context[ALBRequestContext]
  Context --> ELB[elb]
  ELB --> TargetGroupArn[targetGroupArn: string]

Usage

ts
import type { ALBRequestContext } from "./types";

function getTargetGroupArn(context: ALBRequestContext): string {
  return context.elb.targetGroupArn;
}

const context: ALBRequestContext = {
  elb: {
    targetGroupArn:
      "arn:aws:elasticloadbalancing:region:account:targetgroup/example/id",
  },
};

console.log(getTargetGroupArn(context));

AI Coding Instructions

  • Read the target group ARN from context.elb.targetGroupArn.
  • Keep the elb object present when constructing an ALBRequestContext.
  • Treat targetGroupArn as an ARN string; do not parse it unless the calling code needs a specific ARN component.
  • Pass this context through AWS Lambda adapter code when request handling depends on ALB routing metadata.

Was this page helpful?

Download as PDF
ALBRequestContext — Hono (narrator proof)