【问题标题】:AWS CLI V2 "AWS firehose put-record" complaining about Invalid base64:AWS CLI V2“AWS firehose put-record”抱怨无效的 base64:
【发布时间】:2020-10-29 09:29:22
【问题描述】:

我过去可以毫无问题地将记录发送到 firehose

aws firehose put-record --delivery-stream-name my-stream --record='Data="{\"foor\":\"bar\"}"'

但由于我已将我的 cli 更新到版本 2,我收到此错误:

Invalid base64: "{"foor":"bar"}"

我尝试将 {"foor":"bar"} 转换为 based64 但后来我得到了InvalidArgumentException

aws firehose put-record --delivery-stream-name my-stream --record='Data=e1wiYXNkZlwiOlwidGVzdGFtXCJ9Ig=='


An error occurred (InvalidArgumentException) when calling the PutRecord operation: This operation is not permitted on KinesisStreamAsSource delivery stream type.

【问题讨论】:

    标签: aws-cli amazon-kinesis-firehose


    【解决方案1】:

    尝试将“--cli-binary-format raw-in-base64-out”与您的原始命令(没有 base64 编码记录的命令)一起使用。 AWS CLI 版本 2 默认将二进制参数作为 base64 编码的字符串传递。

    参考以下链接:https://docs.aws.amazon.com/cli/latest/userguide/cliv2-migration.html#cliv2-migration-binarypara

    【讨论】:

    • 调用 PutRecord 操作时发生错误(InvalidArgumentException):KinesisStreamAsSource 传输流类型不允许此操作。
    【解决方案2】:

    如果您使用的是 AWS CLI 的 v2,请使用此命令调用对 Firehose 的 putRecord 调用:

    aws firehose put-record --delivery-stream-name STREAM-NAME --cli-binary-format raw-in-base64-out --record="{\"Data\":\"1\"}"

    【讨论】:

      【解决方案3】:

      就我而言,我通过 Windows Powershell CLI 使用 Kinesis。

      aws kinesis put-record --stream-name First-Kinesis --data "Sign In" --partition-key user222 --cli-binary-format raw-in-base64-out
      

      添加以下配置解决了我的问题。

      --cli-binary-format raw-in-base64-out
      

      我希望这对你的目的有所帮助。

      【讨论】:

      • 这对我有帮助。谢谢
      【解决方案4】:

      我收到了同样的错误信息:

      调用时发生错误 (InvalidArgumentException) PutRecord 操作:不允许在 KinesisStreamAsSource 传输流类型。

      ...以上解决方案都没有帮助。

      此错误消息还有另一个原因:当您的传输流配置为使用 Kinesis 流作为源时会发生这种情况。

      创建流时,可以选择流源。可以是:

      • “Amazon Kinesis Data Streams” - 选择此选项会出现错误,

      • “Direct PUT” - 选择此选项可让您使用 CLI 写入流。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-01-05
        • 1970-01-01
        • 1970-01-01
        • 2020-09-29
        • 2021-12-12
        • 1970-01-01
        • 2020-10-28
        相关资源
        最近更新 更多