# get the csv from:
# https://resources.console.aws.amazon.com/r/tags
import csv
from collections import Counter
with open('resources.csv', 'rb') as csvfile:
print("Missing Tags Per Service:")
print("=========================")
reader = csv.DictReader(csvfile)
vals = Counter(
data['Resource type'] for data in reader if data.get(
'Resource type'
)
)
for resource, count in vals.most_common():
print("{0}, {1}".format(resource, count))
with open('resources.csv', 'rb') as csvfile:
print("")
print("Missing Tags Per Service Detail: Resource Type, Region, ResourceID")
print("==================================================================")
reader = csv.DictReader(csvfile)
for row in reader:
if row['Region'] == '':
row['Region'] = "Global"
print("{0}, {1}, {2}".format(row['Resource type'], row['Region'], row['ID']))