我在检查写入Kinesis的数据时遇到了问题。看起来以下示例应该可以工作,但我从get_records(在Records字段中)返回了一个空列表。有什么想法可能出了什么问题吗?
import uuid
import boto3
import time
streamname = 'mytestStream'
session = boto3.session.Session()
kinesis_client = session.client('kinesis', region_name='us-east-1')
##### WRITE TO KINESIS
partitionkey = str(uuid.uuid4())[:8]
put_response = kinesis_client.put_record(StreamName=streamname,Data='mytestdata',PartitionKey=partitionkey)
time.sleep(5)
##### READ FROM KINESIS
shard_id = kinesis_client.describe_stream(StreamName=streamname)['StreamDescription']['Shards'][0]['ShardId']
shard_iterator = kinesis_client.get_shard_iterator(StreamName=streamname, ShardId=shard_id, ShardIteratorType="LATEST")["ShardIterator"]
data_from_kinesis = kinesis_client.get_records(ShardIterator=shard_iterator)
谢谢!