Nux
Nux's Blog

Follow

Nux's Blog

Follow

Count total objects in S3 bucket

Nux's photo
Nux
·Aug 30, 2022·

1 min read

There are several ways to count the objects in S3 bucket. But, there is deficiency regarding the API calls which has its own price. So here are some ways that I usually do to count the objects.

1. By using aws cli

I know this is the programmatically way to get the total objects, but beware for the GET api calls pricing, if there's too much files it will cost you a lot of money.

  aws s3 ls s3://<bucket_name>/ --recursive | wc -l

2. By using web console

Go to buckets > bucket-name > Metrics.

You will see some metrics like total bucket size, total number of objects, and more.

Screen Shot 2022-08-30 at 14.15.50.png

 
Share this