How it works...

In summary, we did the following in this recipe:

  1. Created a KDS using AWS CLI commands and the CloudFormation template
  2. Added two data records into the stream
  3. Retrieved the stream iterator with the shard iterator type as TRIM_HORIZON
  4. Retrieved the data records, passing the shard iterator value

You can add data to a KDS from the CLI using the aws kinesis put-record command, specifying the stream name and a partition key. The partition key determines which shard a given data record belongs to. A stream is composed of many shards and each shard has a fixed capacity. Based on the data rate capacity requirements, you can increase or decrease the number of shards.

The following are some of the limitations of a Kinesis shard:

  • Five transactions per second for reads 
  • Total data read rate of 2 MBps
  • 1,000 records per second for writes
  • Data write rate of 1 MBps

Unlike adding records, retrieving records from a Kinesis stream is a two-step process:

  1. You first need to retrieve the shard iterator, passing the stream name, the shard ID, and the shard iterator type.
  2. Then you need to retrieve data records using the shard iterator. The shard iterator type determines how the shard iterator is used to start reading data records from the shard.

Let's look at the different shard types in detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.197.136