无法在 boto3 中获取 Kinesis 的 AT_TIMESTAMP 迭代器

Ton*_*ang 5 amazon-web-services amazon-kinesis boto3

我正在尝试使用这段Python代码(使用boto3)获得一个分片迭代器:

  # read data between 10 seconds ago and now
  start_timestamp = int(time.time()) - 10
  client.get_shard_iterator(
    StreamName='stream-name',
    ShardId=shard_id,
    ShardIteratorType='AT_TIMESTAMP',
    Timestamp=start_timestamp,
  )['ShardIterator']
Run Code Online (Sandbox Code Playgroud)

但出现以下错误:

调用GetShardIterator操作时发生错误(InvalidArgumentException):timestampInMillis参数不能大于currentTimestampInMillis。时间戳毫秒:1488245410000,当前时间戳毫秒:1488245353431

我不确定 Kinesis 如何定义currentTimestampInMillis. 不知何故,它总是比我time.time()在 Python 中得到的结果晚 66 秒以上。结果,我必须改为-10获取-76迭代器。

我用谷歌搜索了一下,但似乎找不到任何以前发生过的问题。

我也四处搜寻currentTimestampInMillis,希望能找到一种方法来找回它的价值。但没有这样的信息。

任何帮助表示赞赏!