Authorization Lambda caching based on api-key and path

0

I have an Authorization Lambda for my API Gateway.

This Lambda will take an api-key in the header, and the event.path, that is, the requested path, and based on this combination will either allow the request to proceed or return a 403 Forbidden.

I want to enable Authorization Caching, however, it's not clear to me how the keys in the cache are formed. I want the cache key to consider both the api-key and the requested path, how can I do this?

1개 답변
2

Assuming that this is a REST API and a REQUEST type Lambda, the default cache key used for Lambda authorizers is the resource path.

On REQUEST type Lambda authorizers, you have the ability to define “identity sources” which are used to create the cache key.

When multiple identity sources are defined they are used in combination to create the cache key.

You can define the identity sources in the Lambda Event Payload (you can find this in the Edit Authorizer settings) in order to create a cache key based on the resource path as well as the value of the x-api-key header.

AWS
지원 엔지니어
Tim_P
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠