【问题标题】:AWS timestream-write gets "An error occurred (AccessDeniedException) when calling the DescribeEndpoints operation: This operation is not allowed."AWS timestream-write 收到“调用 DescribeEndpoints 操作时发生错误 (AccessDeniedException):不允许此操作。”
【发布时间】:2022-04-22 17:26:16
【问题描述】:

我正在试验 AWS SDK for python 来访问 Timestream。我尝试了来自repository 的内部示例代码,并编写了自己的代码来创建数据库:

import boto3
from botocore.config import Config

client = boto3.client('timestream-write')

response = client.create_database(DatabaseName='test')

示例代码和我自己的代码都出现以下错误:

AccessDeniedException:发生错误 (AccessDeniedException) 时 调用 DescribeEndpoints 操作:该操作不是 允许。

我用谷歌搜索了一下,但我找不到任何关于它的信息。谢谢!

【问题讨论】:

    标签: amazon-web-services amazon-timestream


    【解决方案1】:

    Timestream 目前仅在少数几个地区提供。确保 boto3 区域配置为那些符合条件的区域设置了正确的区域。

    【讨论】:

      【解决方案2】:

      您用于与 Timestream 交互的凭证应使用具有 AWS 托管策略或允许您调用 timestream:DescribeEndpoints 的自定义策略的 IAM 角色。有关示例,请参见此页面:https://docs.aws.amazon.com/timestream/latest/developerguide/security_iam_id-based-policy-examples.html

      假设您将环境配置为使用 AWS CLI 并运行 aws configure,则应向与这些凭证绑定的 IAM 用户授予 timestream:DescribeEndpoints。 https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html

      您可能收到此权限错误,因为您缺少 TableName,这是一个必需的参数。 https://docs.aws.amazon.com/timestream/latest/developerguide/API_CreateTable.html

      【讨论】:

        【解决方案3】:

        在您的 iam 角色中添加此权限策略

        {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "VisualEditor0",
                "Effect": "Allow",
                "Action": [
                    "timestream:DescribeEndpoints"
                ],
                "Resource": "*"
            }
        ] }
        

        DescribeEndpoints 被称为 bt sdk,以防您在 vpc 中定义这样的端点接口 查询-cell2.timestream..amazonaws.com.

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-01-19
          • 2019-12-16
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-07-01
          • 2019-07-22
          相关资源
          最近更新 更多