amazon-web-serviceslambdaaws-lambdaamazon-waf

How to add the lambda on WAF accept origin


I have lambda script which access the url.

In lambda.

url = "https://example.com"
req =  request.Request(url, data={})
res = request.urlopen(req)

As for, https://example.com/ (aws load balancer), there is a FW which accept only some ips defined by ipsets.

So, I need to add the rule to this FAW for passing the lambda access.

Is there any good way to to this?


Solution

  • If you want static IP for your lambda function for the outgoing internet traffic, you have to place your lambda in a VPC, in a private subnet and setup NAT gateway. NATs have static IPs so your lambda will use that IP to access the internet.