Setting up an Amazon Kinesis Stream

In this section, we will implement a Kinesis Stream and familiarize ourselves with a few useful Kinesis CLI commands.

  1. Log into the AWS Management Console and go to Amazon Kinesis Console. Click on the Get started button:
  1. Click on the Create data stream button on the Get started with Amazon Kinesis screen: 
  1. Specify a name for the Kinesis stream as KinesisTestStream :
Specify the Number of shards as 1. Click on the Create Kinesis stream button:
  1. You should temporarily see the Status as CREATING, as shown in the following screenshot:
  1. After the stream is created, you should see a success message, as shown in the following screenshot:
The Status of the Kinesis stream will change to ACTIVE.
  1. Select the Kinesis stream and then click on Details from the Actions menu:
  1. View the details of the Kinesis stream you just created in the Details tab:
  1. Execute the describe-stream command to display the details of the Kinesis stream:
Aurobindos-MacBook-Pro-2:Downloads aurobindosarkar$ aws kinesis describe-stream --stream-name KinesisTestStream
  1. You can list all your Kinesis streams with the list-streams command:
Aurobindos-MacBook-Pro-2:Downloads aurobindosarkar$ aws kinesis list-streams
  1. Insert a test record with the put-record command:
Aurobindos-MacBook-Pro-2:Downloads aurobindosarkar$ aws kinesis put-record --stream-name KinesisTestStream --partition-key 123 --data "Test Event Record"
  1. Use the get-shard-iterator to get the Shard Iterator and copy its value:
Aurobindos-MacBook-Pro-2:Downloads aurobindosarkar$ aws kinesis get-shard-iterator --shard-id shardId-000000000000 --shard-iterator-type TRIM_HORIZON --stream-name KinesisTestStream
{
"ShardIterator": "AAAAAAAAAAGBmIC9k7uah4A0bb0oCW2QfniIesq8snvGJjvlu6D6/UyejLbcjUZK/hzRmSnJtTlQpVpInUoOvacIavV0f4/7X4UE9637qgQi9lc5UqrzXfXKs1Yl4H1Cmp97LD1si3LqqClCsWebTGW8+YUlWFXKfm0kle270c/gcFUqHsxlqyV1XH7XnsY7JVF+0opxvWNygX0Gce0ld4xmCYJ4RPNX"
}
  1. Use the get-records command (with the shard iterator value) to display the records:
Aurobindos-MacBook-Pro-2:Downloads aurobindosarkar$ aws kinesis get-records --shard-iterator AAAAAAAAAAFn2BntwTpAyLoy9V1e1pQ9OiPz44MAMq+fXKPvG/S0eLoKaeuy/NDWq407234Oc1UgtS5rNOjwN+Zz0YSLDKgSmG/muEwi9ZAA+b91WxjZGatpMTHmizMIdYHkWvLvltzFDbCd/ezoOeE3t2kWWFz0ospxacohJxWicFOnuTrAXymSpaUdWCL5junBCwQ78h4t5v3E38P+zbYbh9OYgy4o
..................Content has been hidden....................

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