Skip to Content

3 ways to get AWS S3 bucket size

When it comes to Amazon Web Services (AWS), S3 is one of the most popular services. This is because S3 provides a secure and scalable storage solution for businesses of all sizes. In order to ensure that your S3 buckets are sized correctly, you need to understand how to calculate their size.

In this blog post, we will discuss three methods for getting the size of an S3 bucket in AWS. Let’s get started!

What is an S3 bucket in AWS?

An S3 bucket is a simple storage container that can store an unlimited number of objects, up to 5TB in size each.

Buckets are used to store objects that are related to one another. For example, you could have a bucket called “images” in which you store all of the images for your website.

Get Your Free Linux training!

Join our free Linux training and discover the power of open-source technology. Enhance your skills and boost your career! Learn Linux for Free!

Get AWS S3 bucket size in console

The best method for getting the size of an S3 bucket is to use the AWS Management Console. To do this, simply login to your AWS account and navigate to the S3 service page. On this page, you will see a list of all of your S3 buckets.

  1. Open the AWS S3 console and click on your bucket
  2. Click on the Metrics Tab
  3. In the Bucket Metrics section, the Total bucket size graph shows the total size of the objects in the bucket

 

Get AWS S3 bucket size with CLI

The second method for getting the size of an S3 bucket is to use the AWS Command Line Interface (CLI). To do this, you will need to first install the AWS CLI on your computer. Once you have done this, you can run the following AWS CLI command to get the size of an S3 bucket:

aws s3 ls s3://your_bucket --recursive --human-readable --summarize

The command’s output shows:

  • the date the objects were created
  • their individual file sizes
  • their path
  • the total number of objects in the s3 bucket
  • the total size of the objects in the bucket

 

Get AWS S3 bucket size with S3 Storage lens

The third and final method for getting the size of an S3 bucket is to use the AWS S3 Storage lens. Navigate to the S3 console and click on the View Storage Lens dashboard button.

It provides us with free of charge metrics, including:

  • number of buckets
  • total objects in your account / specific bucket
  • total storage in your account / specific bucket
  • average number of objects
  • many others

The metrics get collected daily and are retained for a period of 14 days.