내용으로 건너뛰기

Api gateway resource policy insights

-1

I have public rest api gateway with three get resources with three different v1 v2 and v3 endpoints. Here v1 and v2 has only resource policy and v3 has lambda authoriser. I have some ip list to access the api gateway and in resources of I allow allow ip v3 behave differently and the api is exposed to all the other ip as well as it has lambda authoriser, if I use deny with notinip condition is resource policy and v1 and v2 are endpoints are getting access denied as it has deny effect how to fix this issue

2개 답변
5

I believe in the case:

  • v1 and v2 endpoints are secured solely through a resource policy that enforces IP allow/deny restrictions.
  • v3 is protected by both the same resource policy and a Lambda authorizer.
  • When a Deny statement with a NotIpAddress condition is added to the resource policy, it applies uniformly across all resources—v1, v2, and v3.
  • Because resource policies are evaluated before authorizers, any request denied at the policy level is never forwarded to the Lambda authorizer for further evaluation.

https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-authorization-flow.html

전문가

답변함 일 년 전

0

Hey,

Hope you're keeping well.

In API Gateway, a resource policy is applied at the API level and affects all resources under that API before any authorizer logic runs. If you use a Deny with NotIpAddress, it will block requests to v1, v2, and v3 regardless of whether v3 has a Lambda authorizer. To scope IP restrictions differently, you can split v3 into its own API Gateway deployment with a separate resource policy, or remove the IP-based deny from the global policy and enforce it inside the Lambda authorizer for v3. This way v1 and v2 remain IP-restricted at the resource policy level, while v3 can apply its own logic after the authorizer runs.

Thanks and regards,
Taz

답변함 10달 전

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

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