如何使用 AWS 开发工具包更新 FireHose 传输流的 DataFormatConversionConfiguration?

How can I update a FireHose delivery stream's DataFormatConversionConfiguration using the AWS SDK?

有没有人有使用 firehose.update_destination 设置 S3 目的地的 DataFormatConversionConfiguration 的工作示例?我遵循 中的指导,使用 boto3(AWS Python SDK),但我没有成功。当我在 ExtendedS3DestinationConfiguration 参数中包含 DFCC 时,它失败并出现以下错误:

Exception during processing: An error occurred (InvalidArgumentException) when calling the UpdateDestination operation: RoleArn must not be null or empty

如果我通过原始目标配置(由 describe_delivery_stream 返回)不变,则更新成功。我还可以更改其他配置选项,例如BufferingHints。唯一失败的时间是 DataFormatConversionConfiguration 为非空时。

例如,传递这个有效:

{
  "RoleARN": "arn:aws:iam::1234567:role/MyExecutionRole",
  "BucketARN": "arn:aws:s3:::my-bucket",
  "Prefix": "databases/tables/requests/",
  "BufferingHints": {
    "SizeInMBs": 64,
    "IntervalInSeconds": 120
  },
  "CompressionFormat": "UNCOMPRESSED",
  "EncryptionConfiguration": {
    "NoEncryptionConfig": "NoEncryption"
  },
  "CloudWatchLoggingOptions": {
    "Enabled": false
  },
  "S3BackupMode": "Disabled"
}

但是传递失败:

{
  "RoleARN": "arn:aws:iam::1234567:role/MyExecutionRole",
  "BucketARN": "arn:aws:s3:::my-bucket",
  "Prefix": "databases/tables/requests/",
  "BufferingHints": {
    "SizeInMBs": 64,
    "IntervalInSeconds": 120
  },
  "CompressionFormat": "UNCOMPRESSED",
  "EncryptionConfiguration": {
    "NoEncryptionConfig": "NoEncryption"
  },
  "CloudWatchLoggingOptions": {
    "Enabled": false
  },
  "S3BackupMode": "Disabled",
  "DataFormatConversionConfiguration": {
    "InputFormatConfiguration": {
      "Deserializer": {
        "OpenXJsonSerDe": {
        }
      }
    },
    "SchemaConfiguration": {
      "TableName": "requests",
      "DatabaseName": "mydb"
    },
    "OutputFormatConfiguration": {
      "Serializer": {
        "OrcSerDe": {
        }
      }
    }
  }
}

唯一的区别是 DataFormatConversionConfiguration 元素。

我是不是忽略了一些明显的东西?也许 DFCC 元素格式不正确?我一直无法找到任何工作示例,所以我将纯粹从文档中获取。

我也对在输入元素中使用 RoleARNBucketARN 与通常使用的 RoleArnBucketArn 感到惊讶,但不是确定是否密切相关。

如您所料,您的 DataFormatConversionConfiguration 格式不正确。

也许令人困惑的是,我认为 RoleArn 它抱怨丢失的是 DataFormatConversionConfiguration.SchemaConfiguration.RoleARN

我不打算在这里全部复制,但我发现查看服务文档是查找有关 SDK 使用的类型的更深入信息的最佳方式:https://docs.aws.amazon.com/firehose/latest/APIReference/API_DataFormatConversionConfiguration.html