Files
aws-inventory/init_workbook.py
T
2026-01-23 08:59:50 +08:00

31 lines
575 B
Python
Executable File

#!/usr/bin/python3
r"""
Documentation
License: This program is released under the MIT License
"""
# Imports
from openpyxl import Workbook
from datetime import datetime
import boto3
# Main function
def main() -> None:
client = boto3.client('sts')
response = client.get_caller_identity()
accountId = response['Account']
wb = Workbook()
ws = wb.active
ws['A1'] = f"AWS Inventory for {accountId}"
ws['A2'] = "Created on"
ws['B2'] = datetime.now()
wb.save('aws-inventory.xlsx')
# Call main function
if __name__ == '__main__':
main()