我有一个非常令人困惑的问题。我正在尝试创建一个带有附加事件的s3存储桶触发lambda。这是我的代码:
#s3-test-bucket
---
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
project:
Description: project
Type: String
ConstraintDescription: Any string
EnvironmentApp:
Description: EnvironmentApp
Type: String
ConstraintDescription: Any string
S3BucketName:
Description: EnvironmentApp
Type: String
ConstraintDescription: Any string
Resources:
S3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub images-${EnvironmentApp}
NotificationConfiguration:
LambdaConfigurations:
-
Function: arn:aws:lambda:us-east-1:xxxxxxxxxxx:function:test-
trigger-cfn
Event: "s3:ObjectCreated:*"
Filter:
S3Key:
Rules:
-
Name: suffix
Value: zip
DeletionPolicy: Delete
现在问题是当我运行它时出现以下错误:
10:25:56 UTC-0300 CREATE_FAILED AWS::S3::Bucket S3Bucket Unable to validate the following destination configurations
我在运行堆栈之前创建了lambda,这可能是导致问题的原因吗?
更新:这解决了问题:
LambdaPolicy:
DependsOn:
- Lambda
Type: AWS::Lambda::Permission
Properties:
FunctionName:
"Fn::GetAtt": [ LambdaImageResizer, Arn ]
Action: "lambda:InvokeFunction"
Principal: "s3.amazonaws.com"
SourceArn: arn:aws:s3:::xxxxx
答案 0 :(得分:0)
请检查您是否允许对lambda函数使用invokeFunction权限。
这看起来与AWS论坛中所述的类似问题 https://forums.aws.amazon.com/thread.jspa?threadID=167470