Adding IP whitelisting security to API gateway

我与影子孤独终老i 提交于 2019-12-11 06:23:29

问题


I have a API on AWS API gateway which calls LAMBDA function and I want to add IP whitelisting for that API so the allowed IPs only can have access to that API. How can I achieve this?


回答1:


There is a really extended blog post about this which you can find here.

Bottom line, it comes to this:

  1. per method, select IAM Authorization method.
  2. Create a new IAM policy that looks like the one below and attach it to the API Method

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "execute-api:Invoke" ], "Condition": { "IpAddress": { "aws:SourceIp": "xxx.xx.xx.xx/32" } }, "Resource": "arn:aws:execute-api:::*" } ] }

you can add multiple SourceIps if needed



来源:https://stackoverflow.com/questions/50227727/adding-ip-whitelisting-security-to-api-gateway

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!