I need to invoke the lambda function2
from lambda function1
using aws sdk.
So far I have the following policy on function1
{
"Sid": "AllowToInvokeLambda",
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:eu-west-1:XXX:function:function2"
},
But it fails with AccessDeniedException: status code: 403
CodePudding user response:
I think you need to double-check again your Lambda Permissions with Execution Role as below.
Ensure that it has the permission to invoke other Lambda functions. Here is a simple policy I use:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "lambda:InvokeFunction",
"Resource": "*"
}
]
}
To test this, I have a simple code here:
client = boto3.client('lambda')
response = client.invoke(
FunctionName='invoke-test-2',
InvocationType='Event',
Payload='{}',
)
print(response)