Question
How to attach the assumable role with the lambda invocations to an API Gateway API or all methods?
Create an API Gateway API for AWS Lambda Functions tells to attach an IAM policy to invoke Lambda:
This means that, at minimum, you must attach the following IAM policy to an IAM role for API Gateway to assume the policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "*"
}
]
}
An API Gateway assumable role is an IAM role with the following trusted relationship:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "apigateway.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
Research
It looks lambda_permission can attach per method basis but not sure if there is a way to be able to invoke any method "*".
Update
Api Gateway can't invoke Lambda function tells a way to attach from UI per method/function.