feat: ported all scripts from bash to python. results are now written to a spreadsheet

This commit is contained in:
KenF
2026-01-22 17:17:12 +08:00
parent cf6db0fa0a
commit 859a482bb2
27 changed files with 556 additions and 157 deletions
+9 -3
View File
@@ -7,16 +7,22 @@ License: This program is released under the MIT License
# Imports
import boto3
from openpyxl import load_workbook
# Main function
def main() -> None:
# Open spreadsheet and add a sheet
wb = load_workbook('aws-inventory.xlsx')
ws = wb.create_sheet("Cloudfront")
client = boto3.client('cloudfront')
response = client.list_distributions()
print("Distribution, Alias, OriginId")
ws.append(["Distribution", "Alias", "OriginId"])
for i in response['DistributionList']['Items']:
print(f'{i["Id"]}, {i["Aliases"]["Items"][0]}, {i["Origins"]["Items"][0]["Id"]}')
ws.append([i["Id"],i["Aliases"]["Items"][0], i["Origins"]["Items"][0]["Id"]])
wb.save('aws-inventory.xlsx')
# Call main function
if __name__ == '__main__':