#!/usr/bin/env python3 import boto3 client = boto3.client('config') resp = client.get_discovered_resource_counts() print("ResourceType, ResourceId") for item in resp['resourceCounts']: if item['resourceType'] == "AWS::Config::ResourceCompliance": continue reslist = client.list_discovered_resources(resourceType=item['resourceType']) for res in reslist['resourceIdentifiers']: print(item['resourceType'], res['resourceId'], sep=', ')