For a API Gate / Lambda combo, there is a bit of a gotch when setting those two services together and following their hello world example.
Instead of the default in their example:
# print(“value2 = ” + event[‘key2’])
use:
event[‘params’][‘querystring’][‘key1’]
I wish it was more evident in their documentation what “event” means, but basically, after you set the above, you need to also set the query params (spell out what they will be) under: Amazon API Gateway / Resources / Method execution
Also, in that section, Integration Request, specify:
“When there are no templates defined (recommended)”
and add a new template for: “application/json”
In the “Generate Template” section, choose: “Method Request Pass through”
Leave the default code in there, and now, when you pass your parameters as:
your-api-gateway-url?yourparam=yourvalue
you will see those values in your python script as:
event[‘params’][‘querystring’][‘yourparam’]