AWS CLI V2“AWS firehose put-record”抱怨无效的 base64:

Am1*_*3zA 10 aws-cli amazon-kinesis amazon-kinesis-firehose

我曾经能够将记录发送到 firehose 而不会出现任何这样的问题

aws firehose put-record --delivery-stream-name my-stream --record='Data="{\"foor\":\"bar\"}"'
Run Code Online (Sandbox Code Playgroud)

但自从我将 cli 更新到版本 2 后,我收到此错误:

Invalid base64: "{"foor":"bar"}"
Run Code Online (Sandbox Code Playgroud)

我尝试将 {"foo":"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.
Run Code Online (Sandbox Code Playgroud)

vij*_*j34 16

就我而言,我通过 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
Run Code Online (Sandbox Code Playgroud)

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

--cli-binary-format raw-in-base64-out
Run Code Online (Sandbox Code Playgroud)

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

  • 这对我有帮助。谢谢 (2认同)

Tyl*_*ler 7

如果您使用的是 AWS CLI v2,请使用以下命令对 Firehose 进行 putRecord 调用:

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


小智 1

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

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

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