Following this tutorial on AWS, I hit a roadblock when trying to test the api through the web console (as many others did):
Thu Nov 10 22:54:48 UTC 2016 : Execution failed due to configuration error: Invalid permissions on Lambda function
I've read every relevant post on SO and AWS forums I could find, but can't figure out how to grant permission to the API Gateway to invoke the Lambda function.
Web Console Method:
Thanks to this mate I found a quick fix:
Go into the web console and select
The resource method > Integration Request > Pencil next to Lambda Function > Check mark next to lambda function (don't change the name)
A popup window should warn that you are granting permissions to the API to execute the lambda function.
API Method:
Also, thanks to Richard Downer for this code explanation:
A resource policy is different from an IAM Policy, setting the IAM policy will not work.
You need to use the Add-LMPermission api call after creation of Write-AGIntegration.
Here is an example:
Add-LMPermission -FunctionName myfunction -Action lambda:InvokeFunction -Principal apigateway.amazonaws.com -SourceArn arn:aws:execute-api:us-west-2:IAMAccountNumber:*/*/POST/apiendpoint -StatementId description