はじめに

CloudFormation にて Data Firehose Stream を作成をしようとしたところ、下記エラーが出力されました。

1
Resource handler returned message: "Model validation failed (#: extraneous key [ProcessingConfiguration] is not permitted)" (RequestToken: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, HandlerErrorCode: InvalidRequest)

このエラーの原因について説明します。

エラーの原因

Model validation failed エラーは主に CloudFormation テンプレートで使用できないプロパティを指定した際に発生します。
今回は Resource 設定にて「S3DestinationConfiguration」が「ProcessingConfiguration」に対応していないことが原因だったため、「ExtendedS3DestinationConfiguration」に修正することで解決しました。

エラーが発生した CloudFormation テンプレート

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Resources:
  RdsAuditStream:
    Type: AWS::KinesisFirehose::DeliveryStream
    Properties:
      DeliveryStreamName: "<firehose name>"
      DeliveryStreamType: DirectPut
      S3DestinationConfiguration:
        BucketARN: "arn:aws:s3:::<test-s3-bucket>¥"
        BufferingHints:
          SizeInMBs: 5
          IntervalInSeconds: 300
        CompressionFormat: GZIP
        Prefix: "rds/audit/" 
        ProcessingConfiguration:
          Enabled: true
          Processors:
          - Type: Decompression
            Parameters:
            - ParameterName: CompressionFormat
              ParameterValue: GZIP
          - Type: CloudWatchLogProcessing
            Parameters:
            - ParameterName: DataMessageExtraction
              ParameterValue: true
        RoleARN: !Sub "arn:aws:iam::${AWS::AccountId}:role/<firehose role arn>"
        CloudWatchLoggingOptions:
          Enabled: false

修正後の CloudFormation テンプレート

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Resources:
  RdsAuditStream:
    Type: AWS::KinesisFirehose::DeliveryStream
    Properties:
      DeliveryStreamName: "<firehose name>"
      DeliveryStreamType: DirectPut
      ExtendedS3DestinationConfiguration:
        BucketARN: "arn:aws:s3:::<test-s3-bucket>¥"
        BufferingHints:
          SizeInMBs: 5
          IntervalInSeconds: 300
        CompressionFormat: GZIP
        Prefix: "rds/audit/" 
        ProcessingConfiguration:
          Enabled: true
          Processors:
          - Type: Decompression
            Parameters:
            - ParameterName: CompressionFormat
              ParameterValue: GZIP
          - Type: CloudWatchLogProcessing
            Parameters:
            - ParameterName: DataMessageExtraction
              ParameterValue: true
        RoleARN: !Sub "arn:aws:iam::${AWS::AccountId}:role/<firehose role arn>"
        CloudWatchLoggingOptions:
          Enabled: false

解説

Firehose でS3を送信先として利用する場合、「S3DestinationConfiguration」と「ExtendedS3DestinationConfiguration」の 2 種類が存在します。
「S3DestinationConfiguration」は現在は非推奨となっており、下記のような追加された機能を利用する場合は「ExtendedS3DestinationConfiguration」を使用する必要があります。

  • バケットプレフィックスのタイムゾーン変更 [ CustomTimeZone ]
  • 入力レコード形式の変換(Parquet, ORC) [ DataFormatConversionConfiguration ]
  • 動的パーティショニング [ DynamicPartitioningConfiguration ]
  • ファイル拡張子の指定 [ FileExtension ]
  • Lambda によるソースレコードの変換、CloudWatch Logs からのソースレコード解凍 [ ProcessingConfiguration ]
  • S3 ソースレコードのバックアップ設定 [ S3BackupConfiguration ]
  • S3 バックアップモード [ S3BackupMode ]

参考URL