Last updated: Feb 26, 2024
Reading time·3 min
To get the size of an AWS S3 Bucket:
Metrics
tab.Total bucket size
graph in the Bucket Metrics
section shows the total
size of the objects in the bucket.You can hover over the line in the graph to look at the size movements of your bucket.
These metrics are also available in CloudWatch.
The next graph on the page shows the total number of objects in the S3 bucket.
PUT
or DELETE
actions on the bucket in the past 24 hours, it might not be up to date. Hover over the graph line to see when it was last updated.To get the size of an S3 Bucket using the AWS CLI, run the s3 ls
command,
passing it the recursive
, human-readable
and summarize
parameters.
$0.005
per 1,000
requests, where each request returns a maximum of 1,000
objects (us-east-1
region). For example, if your bucket contains 1,000,000
objects, you would make 1,000
requests and the List operation would cost you $0.005
.aws s3 ls s3://YOUR_BUCKET --recursive --human-readable --summarize
The command's output shows:
The parameters we passed to the s3 ls command are:
Name | Description |
---|---|
recursive | performs the command on all files under the set prefix |
human-readable | displays the file sizes in human-readable format |
summarize | displays the total number of objects and their total size |
To get the size of the objects in a specific folder of an S3 bucket, call the
s3 ls
command with the complete S3 URI pointing to the folder.
aws s3 ls s3://YOUR_BUCKET/YOUR_FOLDER/ --recursive --human-readable --summarize
To get more S3 bucket metrics, navigate to the S3 console and click on the
View Storage Lens dashboard
button.
Then click on the Bucket
tab:
S3 Storage lens provides us with free-of-charge metrics, including:
The metrics are collected daily and are retained for a period of 14 days.
You can learn more about the related topics by checking out the following tutorials: