【问题标题】:Cannot create s3 bucket with event to lamba attached to it in cloudformation无法在 cloudformation 中创建带有事件的 s3 存储桶,以连接到它
【发布时间】:2018-04-01 16:29:48
【问题描述】:

我有一个非常令人困惑的问题。我正在尝试创建带有附加事件的 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

【问题讨论】:

    标签: amazon-web-services amazon-s3 aws-lambda amazon-cloudformation aws-opsworks


    【解决方案1】:

    请检查您是否在您的 lambda 函数上允许了 invokeFunction 权限。

    这看起来与 AWS 论坛中所述类似的问题 https://forums.aws.amazon.com/thread.jspa?threadID=167470

    【讨论】:

      猜你喜欢
      • 2020-02-08
      • 2021-09-17
      • 2022-01-27
      • 2020-09-07
      • 1970-01-01
      • 2016-08-23
      • 2021-07-03
      • 2019-04-15
      • 2020-07-29
      相关资源
      最近更新 更多