6

AWS Firehose が本日リリースされました。私はそれをいじっており、AWS CLI を使用してデータをストリームに入れる方法を見つけようとしています。単純な JSON ペイロードと、JSON 属性にマップされる列を持つ対応する Redshift テーブルがあります。さまざまな組み合わせを試しましたが、cli 経由で JSON ペイロードを渡すことができないようです。

私が試したこと:

aws firehose put-record --delivery-stream-name test-delivery-stream --record '{ "attribute": 1 }'

aws firehose put-record --delivery-stream-name test-delivery-stream --record { "attribute": 1 }

aws firehose put-record --delivery-stream-name test-delivery-stream --record Data='{ "attribute": 1 }'

aws firehose put-record --delivery-stream-name test-delivery-stream --record Data={ "attribute": 1 }

aws firehose put-record --delivery-stream-name test-delivery-stream --cli-input-json '{ "attribute": 1 }'

aws firehose put-record --delivery-stream-name test-delivery-stream --cli-input-json { "attribute": 1 }

役に立たなかったcliヘルプを見てきました。この記事は本日公開されましたが、引数「--firehose-name」が「--delivery-stream-name」に置き換えられたため、彼らが使用するコマンドはすでに古くなっているようです。

4

5 に答える 5

2

資格情報と地域に問題がありますが、この構文により、少なくとも解析エラーを回避できました。

aws firehose put-record --cli-input-json '{"DeliveryStreamName":"testdata","Record":{"Data":"test data"}}'

于 2015-10-09T21:16:29.657 に答える
2

これはうまくいくはずです。すべての引用符をエスケープします。strem_nameをストリーム名に置き換えます。

aws firehose put-record --cli-input-json "{\"DeliveryStreamName\":\"strem_name\",\"Record\":{\"Data\":\"test data\"}}"
于 2016-07-29T09:13:37.750 に答える
1

This is what I have tried and it has worked.

Below is the example for sending JSON records with Single Column and multiple columns.

Single Value in the Data:

Example: Sending a single column which is an integer.

aws firehose put-record --delivery-stream-name test-delivery-stream --record='Data="{\"attribute\":1}"'

Multiple column values in the data :

Example: Sending Integer and String values via Put-record

aws firehose put-record --delivery-stream-name test-delivery-stream --record='Data="{\"attribute_0\":1,\"attribute_1\":\"Sample String Value\"}"'

Example: Sending Integer,String and float values via Put-record

aws firehose put-record --delivery-stream-name test-delivery-stream --record='Data="{\"attribute_0\":1,\"attribute_1\":\"Sample String Value\",\"attribute_2\":\"14.9\"}"'

Acknowledgement of Success :

When the record is sent successfully, kinesis acknowledges it with a record id , which is similar to the one below.

{
"RecordId": "fFKN2aJfUh6O8FsvlrfkowDZCpu0sx+37JWKJBRmN++iKTYbm/yMKE4dQHdubMR4i+0lDP/NF3c+4y1pvY9gOBkqIn6cfp+1DrB9YG4a0jXmopvhjrXrqYpwo+s8I41kRDKTL013c65vRh5kse238PC7jQ2iOWIqf21wq4dPU9R5qUbicH76soa+bZLvyhGVPudNNu2zRyZwCCV0zP/goah54d/HN9trz"

}

This indicates that the put-record command has succeeded.

Streamed Record on S3:

This is how the record the record looks like in S3 after kinesis has processed it into S3.

{"attribute":1}
{"attribute_0":1,"attribute_1":"Sample String Value"}
{"attribute_0":1,"attribute_1":"Sample String Value","attribute_2":"14.9"}

Note : In S3, the records are created in single or multiple files depending on the rate in which we issue the put-record command.

Please do try and comment if this works.

Thanks & Regards, Srivignesh KN

于 2017-07-18T22:09:15.403 に答える
0

いくつかのこと:

  • 配信ストリームを作成しましたか?
  • ドキュメントを読むと、 --cli-input-json '{"Data":"blob"}' または --record 'Data=blob' を実行する必要があるようです
  • 例を確認するには、put-record/firehose の cli で --generate-cli-skeleton を使用してみてください。
于 2015-10-08T04:37:14.347 に答える