code-dumps/aws/aws-inventory-from-awsconfig.py
2024-03-06 09:49:46 +08:00

15 lines
393 B
Python
Executable File

#!/usr/bin/env python3
import boto3
client = boto3.client('config')
resp = client.get_discovered_resource_counts()
for item in resp['resourceCounts']:
print(item['resourceType'])
reslist = client.list_discovered_resources(resourceType=item['resourceType'])
count = 1
for i, res in enumerate(reslist['resourceIdentifiers'], 1):
print(i, res['resourceId'], sep=': ')