Skip to content

Instantly share code, notes, and snippets.

View RobertoTorino's full-sized avatar
😴
In the clouds

Philip RobertoTorino

😴
In the clouds
View GitHub Profile
@RobertoTorino
RobertoTorino / cloudwatch_s3_size.py
Created October 21, 2023 22:43 — forked from adaam/cloudwatch_s3_size.py
Query S3 bucket size by cloudwatch get-metric-data
#!/usr/bin/env python3
# inspire by https://www.slsmk.com/getting-the-size-of-an-s3-bucket-using-boto3-for-aws/
import boto3
import datetime
def main():
# Get all regions
ec2 = boto3.setup_default_session(region_name='us-east-1')
ec2 = boto3.client('ec2')
desc_regions = ec2.describe_regions()