Skip to content

Instantly share code, notes, and snippets.

@noid11
Last active July 30, 2020 13:38
Show Gist options
  • Save noid11/2a35bd5c5e2e732b5008959043b76e44 to your computer and use it in GitHub Desktop.
Save noid11/2a35bd5c5e2e732b5008959043b76e44 to your computer and use it in GitHub Desktop.
Kinesis Data Firehose が HTTP endpoint に送る HTTP リクエスト内容

これは何

Kinesis Data Firehose が任意の HTTP エンドポイントに対してストリームされたデータを送信できるようになったとの事なので、その検証

結論

以下のようなリクエストが POST される事を確認できた

Request Headers

Version: HTTP/1.1
Host: httpdump.io
Connection: close
X-Amz-Firehose-Protocol-Version: 1.0
X-Amz-Firehose-Source-Arn: arn:aws:firehose:ap-northeast-1:000000000000:deliverystream/my-firehose-http-endpoint
User-Agent: Amazon Kinesis Data Firehose Agent/1.0
X-Forwarded-For: 13.112.143.14
X-Forwarded-Proto: https
X-Forwarded-Port: 443
Via: 1.1 vegur
Connect-Time: 0
X-Request-Start: 1596115242315
Total-Route-Time: 0
Content-Length: 8810
X-Request-Id: e05d9ef5-ed63-42d4-befa-0d44f6371045

Request Body

jq で整形したり records 内容を省略している

{
  "requestId": "9821750f-5fdb-457a-a2fa-a42dbf869f3c",
  "timestamp": 1596115241695,
  "records": [
    {
      "data": "SGVsbG8gd29ybGQ="
    },
    ...
    {
      "data": "eyJ0aWNrZXJfc3ltYm9sIjoiUExNIiwic2VjdG9yIjoiRklOQU5DSUFMIiwiY2hhbmdlIjotMC4zMiwicHJpY2UiOjE5LjA2fQ=="
    }
  ]
}

検証方法

  1. http://httpdump.io/ で Create new Endpoint した結果を HTTP エンドポイントとして指定して、 firehose リソースを作成
  2. firehose のマネジメントコンソールに demo data をストリームできるボタンがあるので、リクエストが送信されるまでストリームしておけば OK

参考情報

Stream data to an HTTP endpoint with Amazon Kinesis Data Firehose | AWS Big Data Blog
https://aws.amazon.com/jp/blogs/big-data/stream-data-to-an-http-endpoint-with-amazon-kinesis-data-firehose/

HTTPdump - Test your Webhook and HTTP requests.
http://httpdump.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment