Get the total size and number of objects of a AWS S3 bucket and folders


Warning❗️Though AWS Cloud is pay as you go! If the number of objects in your bucket is too many, you could incur a significant cost, so be mindful that per 1,000 S3 LIST requests you will incur a cost of $0.005. Each LIST request gets around 1,000 object details.

Get Total Size and Object count of AWS Bucket using AWS Console

  1. Login to your AWS Web Console.
  2. Navigate to S3 Console: https://s3.console.aws.amazon.com
  3. Now click on the bucket name that you want to know the size.
  4. Now select all objects by checking the top most checkbox,
    Select All S3 Bucket Objects
  5. Under Actions select: "Calculate total Size"
    Calculate total size AWS S3 Bucket Objects
AWS Total Bucket Size Summary
AWS Total Bucket Size Summary

Note that the total size information will no longer be available after you navigate away from this page - so you can take a note of the total object count and its size.



Get Total Size and Object count of AWS Bucket using AWS CLI Command

  1. Open your terminal/command prompt (make sure you have set the AWS keys using aws config)
  2. Now make use of the S3 ls command with the below options,
    # aws s3 ls s3://c2c-bucket-1 --recursive --human-readable --summarize
    2022-08-17 00:17:46    0 Bytes myfiles/a.txt
    2022-08-17 00:17:46    0 Bytes myfiles/b.txt
    2022-08-17 00:17:46   13 Bytes test.txt
    2022-08-17 00:17:46    0 Bytes test2.txt
    
    Total Objects: 4
    Total Size: 13 Bytes
  3. Make a note of Total Size displayed in Bytes/KibMib/Gib/Tib/iPb
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.