1 réponse
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
Hello.
Have you set a resource-based policy on Lambda as shown below?
Lambdafunction1Permission:
Type: AWS::Lambda::Permission
Properties:
FunctionName:
Ref: function1
Action: lambda:InvokeFunction
Principal: events.amazonaws.com
SourceArn: !GetAtt ScheduleRule.Arn
Lambdafunction2Permission:
Type: AWS::Lambda::Permission
Properties:
FunctionName:
Ref: function2
Action: lambda:InvokeFunction
Principal: events.amazonaws.com
SourceArn: !GetAtt ScheduleRule.Arn
Contenus pertinents
- demandé il y a un an
- demandé il y a un an
- demandé il y a 7 mois
- Réponse acceptéedemandé il y a un an
- AWS OFFICIELA mis à jour il y a 10 mois
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a un an
Thank you for the prompt response. While this solution seems effective, a potential issue arises when dealing with multiple Lambda functions. Specifically, if there are 20 Lambda functions or more, I would need to add this script to each one individually. Are there alternative methods to address this issue?
Lambda's resource-based policy requires resources for each Lambda, so with AWS SAM, I think the only option is to add them one by one. With CloudFormation, I feel like I can loop with "Fn::ForEach", but AWS SAM doesn't seem to be able to use it yet, as shown in the GitHub issue below. https://github.com/aws/aws-sam-cli/issues/4835 For example, if you are using CDK, you can use a for statement to create the same resource in a loop.