Qudoos
Qudoos

Reputation: 626

Scripting permissions to execute lambda from aws api gateway

enter image description here

In the aws UI, I get this message when I want to add a lambda function to aws api gateway integration request. How can I script this using boto3?

Been struggling with doing it using lambda: add_permission but missing something still.

Upvotes: 2

Views: 566

Answers (1)

RyanG
RyanG

Reputation: 4152

This is possible using lambda add_permission API or CLI.

The policy should be structured like this:

... "AWS:SourceArn":"arn:aws:execute-api:[REGION]:[ACCOUNT_ID]:[API_ID]/*/[HTTP_VERB]/[RESOURCE_PATH]"}}, "Action":"lambda:InvokeFunction", "Resource":"arn:aws:lambda:[REGION]:[ACCOUNT_ID]:function:[FUNCTION_NAME]", "Effect":"Allow", "Principal":{"Service":"apigateway.amazonaws.com"} ...

Upvotes: 2

Related Questions