code-dumps/aws/aws-inventory-from-awsconfig.py

15 lines
393 B
Python
Raw Normal View History

2024-03-06 09:49:46 +08:00
#!/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=': ')