3

In API Gateway I have a GET endpoint like following (with some request headers too)

http://awesomedomain/v1/myspecialkey/find?a=b

Is there a way the Lambda (Authorizer) code can read "myspecialkey"?

Thanks in advance

a-sak
  • 1,320
  • 6
  • 21
  • 33

1 Answers1

3

Yes it is possible, when you are building lambda authorizer you can choose Lambda Payload Type to be Request.

Assuming that you have named your first lambda parameter events, then inside of the lambda, you will have access to your parameter values via

event.pathParameters

as well as access to your query string via

event.queryStringParameters

And other request information if needed, such as authorization token which you can extract from event.headers.

the above code uses NodeJs syntax, the same logic holds true for Java but you will need to modify it according to Java syntax

Matus Dubrava
  • 13,637
  • 2
  • 38
  • 54