简体   繁体   中英

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

在此处输入图像描述

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?

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

You can checkout this example: How to restrict access to a lambda

Please note that the resource policy currently only works for the REST API Gateways. https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html

HTTP APIs do not support resource policies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM