amazon-kinesis

list-shard show more shards than provisioned


I have a kinesis data stream which contains 4 shards. However when I use the following command:

aws kinesis list-shards \                                                      
    --stream-name stream --region us-east-1

I get more shards in response:

{
    "Shards": [
        {
            "ShardId": "shardId-000000000000",
            "HashKeyRange": {
                "StartingHashKey": "0",
                "EndingHashKey": "340282366920938463463374607431768211455"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629197963553601158578444092147254587573454320158375938",
                "EndingSequenceNumber": "49629197963564751531177709403716813520960387136782073858"
            }
        },
        {
            "ShardId": "shardId-000000000001",
            "ParentShardId": "shardId-000000000000",
            "HashKeyRange": {
                "StartingHashKey": "0",
                "EndingHashKey": "170141183460469231731687303715884105727"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629562583971205188053748556663691537888312852092026898",
                "EndingSequenceNumber": "49629562583982355560653013868233250471205027557631066130"
            }
        },
        {
            "ShardId": "shardId-000000000002",
            "ParentShardId": "shardId-000000000000",
            "HashKeyRange": {
                "StartingHashKey": "170141183460469231731687303715884105728",
                "EndingHashKey": "340282366920938463463374607431768211455"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629562583993505933252279179805227256160961213598007330",
                "EndingSequenceNumber": "49629562584004656305851544491374786189477675919137046562"
            }
        },
        {
            "ShardId": "shardId-000000000003",
            "ParentShardId": "shardId-000000000001",
            "HashKeyRange": {
                "StartingHashKey": "0",
                "EndingHashKey": "85070591730234615865843651857942052863"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629562611133512839864047543054196393974022389056405554"
            }
        },
        {
            "ShardId": "shardId-000000000004",
            "ParentShardId": "shardId-000000000001",
            "HashKeyRange": {
                "StartingHashKey": "85070591730234615865843651857942052864",
                "EndingHashKey": "170141183460469231731687303715884105727"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629562611155813585062578166195732112246670750562385986"
            }
        },
        {
            "ShardId": "shardId-000000000005",
            "ParentShardId": "shardId-000000000002",
            "HashKeyRange": {
                "StartingHashKey": "170141183460469231731687303715884105728",
                "EndingHashKey": "255211775190703847597530955573826158591"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629562611178114330261108789337267830519319112068366418"
            }
        },
        {
            "ShardId": "shardId-000000000006",
            "ParentShardId": "shardId-000000000002",
            "HashKeyRange": {
                "StartingHashKey": "255211775190703847597530955573826158592",
                "EndingHashKey": "340282366920938463463374607431768211455"
            },
            "SequenceNumberRange": {
                "StartingSequenceNumber": "49629562611200415075459639412478803548791967473574346850"
            }
        }
    ]
}

Why I am seeing more shards than provisioned ? I am looking to check hash ranges for the shards in order to determine wether they are evenly distributed or not but I am confused why I see more shards or where does they come from. Any ideas would be helpful.


Solution

  • Ok I figured it out. It shows all the shards including the parent shards that have been split. If you want to get only active shards check for EndingSequenceNumber in response. The shards with EndingSequenceNumber are close shards. so in this I have only 4 shards which does not EndingSequenceNumber are hence are ACTIVE shards.