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

时间:2018-10-26 19:01:44

标签: amazon-web-services aws-sdk amazon-kinesis-firehose

有人有使用firehose.update_destination来设置S3目标的DataFormatConversionConfiguration的有效示例吗?我遵循Is it possible to specify data format conversion in AWS Cloudformation?中的指南,使用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的常规约定相比,但不确定是否这是德国人。

1 个答案:

答案 0 :(得分:1)

您怀疑您的DataFormatConversionConfiguration格式错误。

也许让我感到困惑的RoleArnDataFormatConversionConfiguration.SchemaConfiguration.RoleARN

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