All Projects → thinow → aws-kinesis-consumer

thinow / aws-kinesis-consumer

Licence: MIT license
Consume an AWS Kinesis Data Stream to look over the records from a terminal.

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to aws-kinesis-consumer

kines
Friendly CLI for Amazon Kinesis Data Streams
Stars: ✭ 46 (+100%)
Mutual labels:  kinesis, kinesis-stream
amazon-kinesis-client-go
Amazon Kinesis Client for Go
Stars: ✭ 15 (-34.78%)
Mutual labels:  kinesis, kinesis-stream
Hello-AWS-Data-Services
Sample code for AWS data service and ML courses on LinkedIn Learning
Stars: ✭ 144 (+526.09%)
Mutual labels:  kinesis, aws-cli
pg2k4j
Postgresql To Kinesis For Java
Stars: ✭ 69 (+200%)
Mutual labels:  kinesis, kinesis-stream
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+42921.74%)
Mutual labels:  kinesis, aws-cli
Zerocode
A community-developed, free, open source, microservices API automation and load testing framework built using JUnit core runners for Http REST, SOAP, Security, Database, Kafka and much more. Zerocode Open Source enables you to create, change, orchestrate and maintain your automated test cases declaratively with absolute ease.
Stars: ✭ 482 (+1995.65%)
Mutual labels:  stream, consumer
kinetic
High-Performance AWS Kinesis Client for Go
Stars: ✭ 20 (-13.04%)
Mutual labels:  stream, kinesis
frizzle
The magic message bus
Stars: ✭ 14 (-39.13%)
Mutual labels:  kinesis, consumer
mock-hls-server
Fake a live/event HLS stream from a VOD one. Useful for testing. Supports looping.
Stars: ✭ 61 (+165.22%)
Mutual labels:  stream
dot
distributed data sync with operational transformation/transforms
Stars: ✭ 73 (+217.39%)
Mutual labels:  stream
create-music-stream
Creates a PCM 16 bit Little Endian Stream from a mp3 file or youtube video
Stars: ✭ 21 (-8.7%)
Mutual labels:  stream
Commander
Arduino Command Line Utility
Stars: ✭ 20 (-13.04%)
Mutual labels:  stream
AnimeDLR
AnimeDLR
Stars: ✭ 47 (+104.35%)
Mutual labels:  stream
streamplify
Java 8 combinatorics-related streams and other utilities
Stars: ✭ 40 (+73.91%)
Mutual labels:  stream
rtsp-video-recorder
Provides an API to record RTSP video stream to filesystem.
Stars: ✭ 21 (-8.7%)
Mutual labels:  stream
sox-stream
📣 A stream-friendly wrapper around SoX
Stars: ✭ 50 (+117.39%)
Mutual labels:  stream
ngx-stream-request-module
基于ngx-stream-module 实现长连接的处理,把长连接数据按照使用的协议转切分为请求(request),与后端服务器使用短连接通讯,完全兼容后端http协议。后端服务器使用推送协议可以很方便的把数据推送到客户端。
Stars: ✭ 15 (-34.78%)
Mutual labels:  stream
kube-tools-aws
A lightweight Docker image with various CLI tooling for working with Kubernetes.
Stars: ✭ 26 (+13.04%)
Mutual labels:  aws-cli
log
A thin (and fast) PSR-3 logger.
Stars: ✭ 45 (+95.65%)
Mutual labels:  stream
ember-contextual-services
Services in Ember are scoped to the app as a whole and are singletons. Sometimes you don't want that. :) This addon provides ephemeral route-based services.
Stars: ✭ 20 (-13.04%)
Mutual labels:  consumer

PyPI version Python versions Docker version Build Status

aws-kinesis-consumer

Consume an AWS Kinesis Data Stream to look over the records from a terminal.

Demo

$ aws-kinesis-consumer --stream-name MyStream
> preparing shards 2/2
> shard_id=shardId-000000000000, records=1
Record-001
> shard_id=shardId-000000000001, records=2
Record-002
Record-003

Usage

Pre-requirement

Connect to AWS and set the default AWS environment variables .

export AWS_DEFAULT_REGION=eu-central-1
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Alternatively, aws configure can help to set the environment variables.

Use with Python

# install
pip install aws-kinesis-consumer

# consume a stream
aws-kinesis-consumer --stream-name MyStream

Use with Docker

docker run \
  -e AWS_DEFAULT_REGION \
  -e AWS_ACCESS_KEY_ID \
  -e AWS_SECRET_ACCESS_KEY \
  -e AWS_SESSION_TOKEN \
  thinow/aws-kinesis-consumer --stream-name MyStream

Arguments

Default Description
-s --stream-name REQUIRED Name of the AWS Kinesis Stream.
-e --endpoint Custom AWS endpoint url to communicate with the AWS API. Could be used in order to specify a region (e.g. https://kinesis.us-east-1.amazonaws.com/).
-i --iterator-type latest Defines how to start consuming records from the stream. Use latest to consume the new records only. Or use trim-horizon to consume all the records already existing in the stream.
-m --max-records-per-request 10 Defines the maximum number of records per request.
-r --region AWS region of the stream (e.g. us-east-1). By default, the AWS region available in your terminal (e.g. environment variable AWS_DEFAULT_REGION).
-h --help Prints the help message.
-V --verbose Prints all the details when an error stops the application.
-v --version Prints the version of the binary.

FAQ

What is the motivation ? What is the issue with AWS CLI ?

The AWS CLI is able to fetch records from Kinesis, but the users need to list the shards, to generate iterator tokens, use subsequent tokens, delay operations, and so on.

aws-kinesis-consumer in contrary is able to get records by using the stream name, and only the stream name. Therefore there is no need for an extra script.

How to filter the records ?

aws-kinesis-consumer can be piped with other command such as grep, or even jq to filter json records.

# all the records
$ aws-kinesis-consumer --stream-name MyStream
{"name":"foo", "status":"ok"}
{"name":"bar", "status":"pending"}
{"name":"baz", "status":"error"}

# records containing the text "ba" (e.g. "bar" and "baz", but not "foo")
$ aws-kinesis-consumer --stream-name MyStream | grep "ba"
{"name":"bar", "status":"pending"}
{"name":"baz", "status":"error"}

# records where the json property "status" has the value "error"
$ aws-kinesis-consumer --stream-name MyStream | jq 'select(.status == "error")'
{"name":"baz", "status":"error"}

What are the required AWS permissions ?

aws-kinesis-consumer requires the following AWS permissions :

The following policy is an example which can be applied to an AWS user or an AWS role :

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "kinesis:ListShards",
                "kinesis:GetShardIterator",
                "kinesis:GetRecords"
            ],
            "Resource": [
                "arn:aws:kinesis:REGION:ACCOUNT-ID:stream/STREAM-NAME"
            ]
        }
    ]
}

How to contribute to the project ?

See the guidelines in the CONTRIBUTING.md file .

Changelog

See all the changes per release.

Special thanks

  • Thanks to the contributors of the kinesalite project which make test and development of this project extremely easy and reliable!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].