diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..b58b603
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,5 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/aws-inventory.iml b/.idea/aws-inventory.iml
new file mode 100644
index 0000000..555ffe3
--- /dev/null
+++ b/.idea/aws-inventory.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..debf80d
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..236fbbf
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..61d771e
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 1149cc6..99b15e6 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@ Scripts to collect AWS resource inventory in all regions.
- awscli
- gnu parallel
- miller
+- python 3.13+
## Usage
Run run-inventory-scripts.sh which will invoke a collection of scripts. TSV is returned for visibility.
diff --git a/aws-apigw-inventory.sh b/aws-apigw-inventory.sh
deleted file mode 100755
index def4f6c..0000000
--- a/aws-apigw-inventory.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-#RESTYPE=ApiGateway
-
-# Generate inventory in all regions
-echo "RestAPI,Scope"
-aws apigateway get-rest-apis | jq -cr '.items[] | [.name, .endpointConfiguration.types[0]] | @csv'
diff --git a/aws-apigw.py b/aws-apigw.py
new file mode 100755
index 0000000..a9d3cad
--- /dev/null
+++ b/aws-apigw.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+r"""
+Documentation
+
+License: This program is released under the MIT License
+"""
+
+# Imports
+import boto3
+
+
+# Main function
+def main() -> None:
+ client = boto3.client('apigateway')
+ response = client.get_rest_apis()
+
+ print("RestAPIName,Scope")
+ for i in response['items']:
+ print(f'{i["name"]}, {i["endpointConfiguration"]["types"][0]}')
+
+# Call main function
+if __name__ == '__main__':
+ main()
diff --git a/aws-cloudfront-inventory.sh b/aws-cloudfront-inventory.sh
deleted file mode 100755
index 23bee65..0000000
--- a/aws-cloudfront-inventory.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-# Generate inventory in all regions
-
-echo "CFDist,Alias"
-aws cloudfront list-distributions | jq -cr '.DistributionList.Items[] | [.Id, .Aliases.Items[0]] | @csv'
-
diff --git a/aws-cloudfront.py b/aws-cloudfront.py
new file mode 100755
index 0000000..e1ec59c
--- /dev/null
+++ b/aws-cloudfront.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+r"""
+Documentation
+
+License: This program is released under the MIT License
+"""
+
+# Imports
+import boto3
+
+
+# Main function
+def main() -> None:
+ client = boto3.client('cloudfront')
+ response = client.list_distributions()
+
+ print("Distribution, Alias, OriginId")
+ for i in response['DistributionList']['Items']:
+ print(f'{i["Id"]}, {i["Aliases"]["Items"][0]}, {i["Origins"]["Items"][0]["Id"]}')
+
+# Call main function
+if __name__ == '__main__':
+ main()
diff --git a/aws-logs-inventory.sh b/aws-logs-inventory.sh
deleted file mode 100755
index d581e08..0000000
--- a/aws-logs-inventory.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-function listRes() {
- aws --region $1 logs describe-log-groups | jq -cr '.logGroups[] | [.logGroupName, .retentionInDays, .logGroupClass] | @csv' | tr -d \"
-}
-
-export -f listRes
-
-# Generate inventory in all regions
-
-echo "LogGroup, Retention, Class"
-aws --region=us-east-1 ec2 describe-regions --query Regions[].RegionName --output text | sed -e 's/\t/\n/g' | while read r; do
- sem -j6 listRes $r
-done
-
-sem --wait
diff --git a/aws-logs.py b/aws-logs.py
new file mode 100755
index 0000000..cdb1c6d
--- /dev/null
+++ b/aws-logs.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+r"""
+Documentation
+
+License: This program is released under the MIT License
+"""
+
+# Imports
+import boto3
+
+def getRegions(all_regions=False):
+ ec2 = boto3.client('ec2')
+ response = ec2.describe_regions(AllRegions=all_regions)
+ return [region['RegionName'] for region in response['Regions']]
+
+def printResources(region_name: str):
+ client = boto3.client('logs', region_name=region_name)
+ response = client.describe_log_groups()
+ for logGroup in response['logGroups']:
+ print(f"{logGroup['logGroupName']}, {logGroup.get('retentionInDays')}, {logGroup['storedBytes']}, {region_name}")
+
+# Main function
+def main() -> None:
+ print("logGroupName,retentionInDays,storedBytes,region")
+ for r in getRegions():
+ printResources(r)
+
+# Call main function
+if __name__ == '__main__':
+ main()
diff --git a/aws-s3-inventory.sh b/aws-s3-inventory.sh
deleted file mode 100755
index 7f5bb77..0000000
--- a/aws-s3-inventory.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-# Generate inventory in all regions
-echo "BucketName"
-aws s3api list-buckets --query Buckets[].Name --output text | sed 's/\t/\n/g'
diff --git a/aws-s3.py b/aws-s3.py
new file mode 100755
index 0000000..5d88cc5
--- /dev/null
+++ b/aws-s3.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+r"""
+Documentation
+
+License: This program is released under the MIT License
+"""
+
+# Imports
+import boto3
+
+
+# Main function
+def main() -> None:
+ s3_client = boto3.client('s3')
+
+ # Get the list of all buckets
+ response = s3_client.list_buckets()
+
+ # Print the names of the buckets
+ print('Buckets')
+ for bucket in response['Buckets']:
+ print(f'{bucket["Name"]}')
+
+# Call main function
+if __name__ == '__main__':
+ main()
diff --git a/run-inventory-scripts.sh b/run-inventory-scripts.sh
index b35ebb2..72c1777 100755
--- a/run-inventory-scripts.sh
+++ b/run-inventory-scripts.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-for i in aws*.sh; do
+for i in aws*.{py,sh}; do
echo "# $i"
- bash $i | mlr --c2t cat | column -t
+ ./"$i" | mlr --c2t cat | column -t
wait $!
done