【问题标题】:AWS Kinesis object has no attribute: update_shard_countAWS Kinesis 对象没有属性:update_shard_count
【发布时间】:2016-12-29 10:37:22
【问题描述】:

我正在尝试在 AWS Kinesis 中实现动态分片。我创建了一个示例 python 脚本来更新 kinesis 流中的分片计数,使用 Boto3 库将 python 与 AWS Kinesis 连接。 但是当我使用 update_shard_count 方法时,它会给出 Kinesis object no attribute update_shard_count 错误。

import boto3

client = boto3.client('kinesis',region_name='us-east-1')
response = client.update_shard_count(
    StreamName='xyzstream',
    TargetShardCount=2,
    ScalingType='UNIFORM_SCALING' )

Traceback(最近一次调用最后一次):文件“”,第 1 行,in AttributeError:“Kinesis”对象没有属性 'update_shard_count'

那么我如何使用 API 更新 kinesis 分片计数?

【问题讨论】:

  • 我刚刚在 boto3 的 1.4.2 版本中尝试过这个,Ki​​nesis 客户端对象肯定有一个 update_shard_count 方法。你用的是什么版本?

标签: python amazon-web-services boto3 amazon-kinesis


【解决方案1】:

您必须升级您的 Boto3。我有 Boto3 1.4.3,我在 Kinesis 模块中看到了 update_shard_count 方法。接下来我签入旧版本并没有看到该方法。

    >>> import boto3
    >>> boto3.__version__
    '1.4.3'
    >>> client = boto3.client('kinesis')
    >>> client.update_shard_count
<bound method Kinesis.update_shard_count of <botocore.client.Kinesis object at 0x7fbfb7445b90>>

旧版

>>> import boto3
>>> boto3.__version__
'1.4.0'
>>> client = boto3.client('kinesis')
>>> client.update_shard_count

Traceback(最近一次调用最后一次):文件“”,第 1 行,in AttributeError:“Kinesis”对象没有属性 'update_shard_count'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-13
    • 1970-01-01
    • 2022-01-16
    • 1970-01-01
    • 2012-12-01
    • 2021-08-03
    • 2020-05-15
    • 1970-01-01
    相关资源
    最近更新 更多