0

I have an AWS S3 bucket s3://mybucket/. Running the following command to count all files:

aws s3 ls s3://mybucket/ --recursive | wc -l 

outputs: 279847

Meanwhile, the AWS console web UI clearly indicates 355,524 objects:

enter image description here

Why does aws s3 ls s3://mybucket/ --recursive | wc -l list fewer files than the number of objects mentioned in the AWS web UI in my S3 bucket?


Replying to comments:

Bucket versioning is enabled:

enter image description here

3

1 Answer 1

2

When you have versioning enabled, each file version counts as a separate object in the bucket. You can list all versions of objects with the aws s3api CLI command:

aws s3api list-object-versions --bucket mybucket 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.