Search code examples
amazon-web-servicesaws-lambdaserverless-framework

How can I provide resource-based policy in my lambda via serverles.yml?


I am using serverless.yml to deploy lambdas to AWS and I'd like to know how to configure the resource-based policy for my lambda.

I deploy a customised alias to my lambda and need to grant invoke:lambda in the policy of the resouce-based policy. So when you open lambda -> configuration -> permission, the policy should appear as below

enter image description here

when I use the role configure in serverless.yml, it only changes the permission for my lambda execution role. How can I modify the Resource-based policy for my lambda?


Solution

  • I have used before the API Gateway Resource Policy: https://www.serverless.com/framework/docs/providers/aws/events/apigateway/#resource-policy

    For the lambda function association directly you can take a look at that thread: https://github.com/serverless/serverless/issues/4926