通过 cloudformation yaml 添加带有错误操作的 IoT 规则

Adding IoT rule with an error action through cloudformation yaml

我正在尝试使用以下 cloudformation yaml 文件添加带有错误操作的物联网规则

从 yaml 中提取:

 DaIoTRule:
    Type: AWS::IoT::TopicRule
    Properties:
      RuleName: sda
      TopicRulePayload:
        RuleDisabled: false
        Sql: SELECT *, topic(2) AS source FROM 'topic/sensors/+'
        Actions:
          - Lambda:
              FunctionArn: !GetAtt LambdaFunction.Arn
        ErrorAction:
          S3:
            RoleArn: !GetAtt DAIoTRuleErrorActionIamRole.Arn
            Bucket: iot-message-dump
            Key: "errors/${topic()}/${timestamp()}"

但是我一直收到这个错误:

{
            "StackId": "arn:aws:cloudformation:us-east-1:961234632786:stack/wx-da-lambda/91423s00-4e97-11ea-aedd-0ee829hbc650",
            "EventId": "DAIoTRule-CREATE_FAILED-2020-02-17T06:51:38.299Z",
            "StackName": "da-lambda",
            "LogicalResourceId": "DaIoTRule",
            "PhysicalResourceId": "",
            "ResourceType": "AWS::IoT::TopicRule",
            "Timestamp": "2020-02-17T06:51:38.299Z",
            "ResourceStatus": "CREATE_FAILED",
            "ResourceStatusReason": "Encountered unsupported property bucket"
        }

我使用 https://docs.aws.amazon.com/iot/latest/developerguide/rule-error-handling.html 作为参考创建了这个 yaml。

有人可以指出我做错了什么吗?

CloudFormation 使用 BucketName 属性 而不是 Bucket 进行 S3 操作(包括错误操作)。

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iot-topicrule-s3action.html#cfn-iot-topicrule-s3action-bucketname