Amazon Web Services (AWS) - Get Kinesis Shard Iterator using the AWS CLI

by
Jeremy Canfield |
Updated: May 15 2024
| Amazon Web Services (AWS) articles
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
This also assumes you are familiar with Kinesis. If not, check out my article Getting Started with Kinesis.
The aws kinesis list-streams command can be used to list your Kinesis Data Stream. Let's say you have a Kinesis Data Stream named my-kinesis-data-stream.
~]$ aws kinesis list-streams
{
"StreamNames": [
"my-kinesis-data-stream"
],
"StreamSummaries": [
{
"StreamName": "my-kinesis-data-stream",
"StreamARN": "arn:aws:kinesis:us-east-1:123456789012:stream/my-kinesis-data-stream",
"StreamStatus": "ACTIVE",
"StreamModeDetails": {
"StreamMode": "ON_DEMAND"
},
"StreamCreationTimestamp": "2024-05-15T01:13:06+00:00"
}
]
}
And then the aws kinesis get-shard-iterator command can be used to get the Shard Iterator of one of your Shards.
A shard iterator represents the position of the stream and shard from which the consumer will read.
~]$ aws kinesis get-shard-iterator --shard-id shardId-000000000000 --shard-iterator-type TRIM_HORIZON --stream-name my-kinesis-data-stream
{
"ShardIterator": "AAAAAAAAAAEfW0Zybg2XGNf7C/j9I25NCC0egOxYd8RDXGqJMVJ0+zfxz2lmIfsWu+x+P0IZystt75j5cGBtVW1ZFzIJfEXUtEgStUJlv+0A/I1zQR/73yhSzLdaXRFFjsYIljI9jg6a14qJ3b6LMRvwarEvVPYVe7CiPOW6Z8QeihnQ1m/TxbHFiJK3g9eiuJSPNt5YoAJPnpb5nUYng9QcyJYG0Du4cJlMAx3RZMhqkw70zagOoItQ5Hb9v76zq9ns7ojlCb4="
}
Did you find this article helpful?
If so, consider buying me a coffee over at