Search code examples
python-3.xamazon-web-servicesboto3aws-config

How to get AWS config aggregate resources


I am unable to get AWS Config aggregated discovered resources using Python3 and boto3.

Python=3.7 Boto3=1.9.42 Using AWS SAM to locally test Lambda function but I have the same problem when I run the Lambda within AWS.

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

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

Returns error:

{
  "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"
  ]
}

I am however able to run other requests using this client.

This works:

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

Solution

  • You can see that the attribute list_aggregated_discovered_resources is not supported in the boto3 1.9.42 from below reference.

    ConfigService - Boto3 1.9.42

    If you want to use the attribute, then recent version of boto3 is required.