feat: ported all scripts from bash to python. results are now written to a spreadsheet
This commit is contained in:
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/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("route53")
|
||||
|
||||
client = boto3.client('route53')
|
||||
# Get the list of all buckets
|
||||
response = client.list_hosted_zones()
|
||||
|
||||
# Print the names of the buckets
|
||||
ws.append(['Name', 'PrivateZone', 'ResourceRecordSetCount'])
|
||||
for i in response['HostedZones']:
|
||||
ws.append([i["Name"], i['Config']['PrivateZone'], i["ResourceRecordSetCount"]])
|
||||
|
||||
wb.save('aws-inventory.xlsx')
|
||||
|
||||
|
||||
# Call main function
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user