Amazon web services 无法在cloudformation中创建附加了lamba事件的s3 bucket

Amazon web services 无法在cloudformation中创建附加了lamba事件的s3 bucket,amazon-web-services,amazon-s3,aws-lambda,amazon-cloudformation,aws-opsworks,Amazon Web Services,Amazon S3,Aws Lambda,Amazon Cloudformation,Aws Opsworks,我有一个非常令人困惑的问题。我试图创建一个s3 bucket,它附带了一个触发lambda的事件。这是我的密码: #s3-test-bucket --- AWSTemplateFormatVersion: '2010-09-09' Parameters: project: Description: project Type: String ConstraintDescription: Any string EnvironmentApp: Description: Environ

我有一个非常令人困惑的问题。我试图创建一个s3 bucket,它附带了一个触发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

请检查您是否允许对lambda函数使用invokeFunction权限

这看起来与AWS论坛中所述的问题类似