s3bytes is a CLI tool that lists the size and number of objects in all buckets in one shot.
- High speed with concurrent processing
- Various output formats
- Simple processing using CloudWatch Metrics API
- Simple command line flags
List of possible values for flags as follows:
Option | Description | Allowed values | Default value | Environment Variable |
---|---|---|---|---|
--completion value -c value |
print completion scripts | bash zsh pwsh |
- | - |
--profile value -p value |
set aws profile | - | - | AWS_PROFILE |
--log-level value -l value |
set log level | debug info warn error |
info |
S3BYTES_LOG_LEVEL |
--regions value1,value2... -r value1,value2... |
set target regions | af-south-1 ap-east-1 ap-northeast-1 ap-northeast-2 ap-northeast-3 ap-south-1 ap-south-2 ap-southeast-1 ap-southeast-2 ap-southeast-3 ap-southeast-4 ap-southeast-5 ap-southeast-7 ca-central-1 ca-west-1 eu-central-1 eu-central-2 eu-north-1 eu-south-1 eu-south-2 eu-west-1 eu-west-2 eu-west-3 il-central-1 me-central-1 me-south-1 mx-central-1 sa-east-1 us-east-1 us-east-2 us-west-1 us-west-2 |
All regions with no opt-in required | - |
--prefix value -P value |
set bucket name prefix | - | - | - |
--expression value -e value |
set filter expression for metric values | > value >= value < value <= value == value != value |
- | - |
--metric-name value -m value |
set metric name of cloudwatch metrics | BucketSizeBytes NumberOfObjects |
BucketSizeBytes |
- |
--storage-type value -s value |
set storage type of s3 objects | StandardStorage IntelligentTieringFAStorage IntelligentTieringIAStorage IntelligentTieringAAStorage IntelligentTieringAIAStorage IntelligentTieringDAAStorage StandardIAStorage StandardIASizeOverhead StandardIAObjectOverhead OneZoneIAStorage OneZoneIASizeOverhead ReducedRedundancyStorage GlacierIRSizeOverhead GlacierInstantRetrievalStorage GlacierStorage GlacierStagingStorage GlacierObjectOverhead GlacierS3ObjectOverhead DeepArchiveStorage DeepArchiveObjectOverhead DeepArchiveS3ObjectOverhead DeepArchiveStagingStorage AllStorageTypes |
StandardStorage |
- |
--output value -o value |
set output type | json text markdown backlog tsv |
text |
S3BYTES_OUTPUT_TYPE |
--help -h |
show help | - | - | - |
--version -v |
print the version | - | - | - |
JSON format
[
{
"BucketName": "bucket0",
"Region": "ap-northeast-1",
"MetricName": "BucketSizeBytes",
"StorageType": "StandardStorage",
"Value": 23373655,
},
{
"BucketName": "bucket1",
"Region": "ap-northeast-2",
"MetricName": "BucketSizeBytes",
"StorageType": "StandardStorage",
"Value": 134614,
},
{
"BucketName": "bucket2",
"Region": "us-east-1",
"MetricName": "BucketSizeBytes",
"StorageType": "StandardStorage",
"Value": 0,
}
]
Text table format
$ s3bytes -o text
+------------+----------------+-----------------+-----------------+----------+
| BucketName | Region | MetricName | StorageType | Value |
+------------+----------------+-----------------+-----------------+----------+
| bucket0 | ap-northeast-1 | BucketSizeBytes | StandardStorage | 23373655 |
+------------+----------------+-----------------+-----------------+----------+
| bucket1 | ap-northeast-2 | BucketSizeBytes | StandardStorage | 134614 |
+------------+----------------+-----------------+-----------------+----------+
| bucket2 | us-east-1 | BucketSizeBytes | StandardStorage | 0 |
+------------+----------------+-----------------+-----------------+----------+
Compressed text table format
$ s3bytes -o compressedtext
+------------+----------------+-----------------+-----------------+----------+
| BucketName | Region | MetricName | StorageType | Value |
+------------+----------------+-----------------+-----------------+----------+
| bucket0 | ap-northeast-1 | BucketSizeBytes | StandardStorage | 23373655 |
| bucket1 | ap-northeast-2 | BucketSizeBytes | StandardStorage | 134614 |
| bucket2 | us-east-1 | BucketSizeBytes | StandardStorage | 0 |
+------------+----------------+-----------------+-----------------+----------+
Markdown table format
$ s3bytes -o markdown
| BucketName | Region | MetricName | StorageType | Value |
| ---------- | -------------- | --------------- | --------------- | -------- |
| bucket0 | ap-northeast-1 | BucketSizeBytes | StandardStorage | 23373655 |
| bucket1 | ap-northeast-2 | BucketSizeBytes | StandardStorage | 134614 |
| bucket2 | us-east-1 | BucketSizeBytes | StandardStorage | 0 |
Backlog table format
$ s3bytes -o backlog
| BucketName | Region | MetricName | StorageType | Value |h
| bucket0 | ap-northeast-1 | BucketSizeBytes | StandardStorage | 23373655 |
| bucket1 | ap-northeast-2 | BucketSizeBytes | StandardStorage | 134614 |
| bucket2 | us-east-1 | BucketSizeBytes | StandardStorage | 0 |
Install with homebrew
brew install nekrassov01/tap/s3bytes
Install with go
go install github.com/nekrassov01/s3bytes
Or download binary from releases
Supported Shells are as follows:
- bash
- zsh
- pwsh
s3bytes -c bash|zsh|pwsh
- Add code comment
- Support directory buckets if possible