【问题标题】:How to get AWS config aggregate resources如何获取 AWS config 聚合资源
【发布时间】:2019-09-11 16:36:55
【问题描述】:

我无法使用 Python3 和 boto3 获取 AWS Config 汇总的已发现资源。

Python=3.7 博托3=1.9.42 使用 AWS SAM 在本地测试 Lambda 函数,但是当我在 AWS 中运行 Lambda 时遇到了同样的问题。

    client = master_session.client('config', region_name=my_region)

    response = client.list_aggregate_discovered_resources(
        ConfigurationAggregatorName=aggregator,
        ResourceType="AWS::EC2::Instance")

返回错误:

{
  "errorType": "AttributeError",
  "errorMessage": "'ConfigService' object has no attribute 'list_aggregate_discovered_resources'",
  "stackTrace": [
    "  File \"/var/task/app.py\", line 41, in lambda_handler\n    r = client.list_aggregate_discovered_resources(\n",
    "  File \"/var/runtime/botocore/client.py\", line 563, in __getattr__\n    self.__class__.__name__, item)\n"
  ]
}

但是,我可以使用此客户端运行其他请求。

这行得通:

response = client.describe_configuration_aggregators()
print("Response: {}".format(response))

【问题讨论】:

    标签: python-3.x amazon-web-services boto3 aws-config


    【解决方案1】:

    您可以从下面的参考资料中看到 boto3 1.9.42 不支持 list_aggregated_discovered_resources 属性。

    ConfigService - Boto3 1.9.42

    如果要使用该属性,则需要最新版本的 boto3。

    【讨论】:

      猜你喜欢
      • 2020-11-21
      • 1970-01-01
      • 2022-12-21
      • 2022-08-15
      • 2020-02-06
      • 2023-03-13
      • 2018-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多