...created an IAM role called XYZ with the following policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "*"
}
]
}
...updated the trust relationship XYZ role to include both lambda and API gateway
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": [
"lambda.amazonaws.com",
"apigateway.amazonaws.com"
]
},
"Action": "sts:AssumeRole"
}
]
}
...created a Lambda function and attached role XYZ. I can execute the Lambda function successfully.
from __future__ import print_function
import json
import datetime
def lambda_handler(event, context):
ts = datetime.datetime.now().timestamp()
print (ts)
print ("Hello")
#raise Exception('Something went wrong')
...attached an API gateway to the Lambda function. I specified XYZ as the execution role of the method.
I get "null" when invoking the API
Any suggestions as to why?