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?

Sergio
已提問 2 年前檢視次數 1573 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南