30 lines
693 B
Python
Executable File
30 lines
693 B
Python
Executable File
#!/usr/bin/env python3
|
|
r"""
|
|
Documentation
|
|
|
|
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()
|
|
|
|
ws.append(["Distribution", "Alias", "OriginId"])
|
|
for i in response['DistributionList']['Items']:
|
|
ws.append([i["Id"],i["Aliases"]["Items"][0], i["Origins"]["Items"][0]["Id"]])
|
|
|
|
wb.save('aws-inventory.xlsx')
|
|
|
|
# Call main function
|
|
if __name__ == '__main__':
|
|
main()
|