code-dumps/aws/aws-inventory.py

16 lines
505 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 res in reslist['resourceIdentifiers']:
# print(count, res['resourceId'])
# count+=1
for index, item in enumerate(reslist['resourceIdentifiers'], 1):
print(f"{index}. {item['resourceId']}")