aws lambda add-permission \ --function-name myFunction \ --action lambda:InvokeFunction \ --statement-id bd2cbad1-6ccf-48e3-bb92-bc9961bc011e \ --principal apigateway.amazonaws.com
Give the lambda function called myFunction permission to respond to (= to be invoked by) API Gateway. Any and all endpoints from API Gateway will be allowed to invoke this function, as long as they are under the same AWS account and, probably, in the same region. A more granular configuration can be set using a JSON file. This will modify myFunction function's Resource-based policy, which can be found in the Permissions tab in the AWS Console. This permission's unique identifier, referred to as statement-id, is bd2cbad1-6ccf-48e3-bb92-bc9961bc011e.