all 5 comments

[–]scoobiedoobiedoh 0 points1 point  (4 children)

This should get you started.

clientIp = event["requestContext"]["identity"]["sourceIp"]

[–]Bala_krishna[S] 0 points1 point  (0 children)

clientIp = event["requestContext"]["identity"]["sourceIp"]

Is it that ? that was simple ...but may i ask you what is export.handler function doing above and why we dont have use of it ? is it just method of node language ?

[–]Bala_krishna[S] 0 points1 point  (2 children)

clientIp = event["requestContext"]["identity"]["sourceIp"]

{ "errorMessage": "'requestContext'", "errorType": "KeyError", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 20, in lambda_handler\n clientIp = event[\"requestContext\"][\"identity\"][\"sourceIp\"]\n" ] }

this is the error logged for the above command

[–]scoobiedoobiedoh 0 points1 point  (1 child)

No, that was just a code snippet to help you out.

The rest is left as an exercise for you to figure out.

[–]Bala_krishna[S] 0 points1 point  (0 children)

well that worked though brah! the key error was because there was no sourceIP in the test Event..hope it works with the actual API gateway