2024-03-06 09:49:46 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
|
|
import boto3
|
|
|
|
|
|
|
|
client = boto3.client('config')
|
|
|
|
resp = client.get_discovered_resource_counts()
|
2024-04-23 17:37:51 +08:00
|
|
|
|
|
|
|
print("ResourceType, ResourceId")
|
2024-03-06 09:49:46 +08:00
|
|
|
for item in resp['resourceCounts']:
|
2024-04-23 17:37:51 +08:00
|
|
|
if item['resourceType'] == "AWS::Config::ResourceCompliance":
|
|
|
|
continue
|
2024-03-06 09:49:46 +08:00
|
|
|
reslist = client.list_discovered_resources(resourceType=item['resourceType'])
|
|
|
|
|
2024-04-23 17:37:51 +08:00
|
|
|
for res in reslist['resourceIdentifiers']:
|
|
|
|
print(item['resourceType'], res['resourceId'], sep=', ')
|