Is it possible to set pathParameter as an Identity source in API Gateway Authorizer?

0

I'm utilizing an API Gateway and have established a custom Authorizer Lambda. I'm interested in implementing Authorization caching to store policies for quicker access. However, I'd like to utilize a PathParameter as the cache key. To illustrate, let's consider I have a URL like https://mytest.com/{projectId}/test. My goal is to designate projectId as the cache key. This way, as long as the projectId remains consistent, the authorizer only needs to execute once. Any idea about that? Thank you.

Neal
asked 2 months ago134 views
1 Answer
0

Hi, according to the following re:Post responses, for a REST API and a REQUEST type Lambda, the default cache key used for Lambda authorizers is the resource path.

profile picture
EXPERT
answered 2 months ago
  • I apologize if my initial explanation was not clear. To clarify, I am seeking to establish a PathParameter as a component of the cache key. For instance, if the URL is https://mytest.com/{projectId}/test, and I receive 10 requests all sharing the same projectId, I aim to activate the Authorization Lambda only for the initial request. Subsequent requests should then be able to retrieve the policy from the cache. I'm wondering if such a setup is feasible within AWS API Gateway.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions