1 Antwort
- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
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
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 3 Jahren
- AWS OFFICIALAktualisiert vor 8 Monaten
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.