Object storage utilization
You may be interested in the number of objects, or their cumulative size, currently held in a bucket.
Prerequisites
To show the number or cumulative size of objects in a bucket, you must install aws
, mc
, or s3cmd
, and configure it with working credentials.
Showing the number of objects in a bucket
To show the number of objects in a given bucket, use one of the following commands:
aws --profile <region> \
s3 ls \
--recursive \
--summarize \
s3://<bucket>
Total Objects
, at the end of the output.
mc ls <region>/<bucket> \
--recursive \
--summarize
Total Objects
, at the end of the output.
Alternatively, you may also use the du
subcommand:
mc du <region>/<bucket>
s3cmd -c ~/.s3cfg-<region> \
du \
s3://<bucket>
Showing the total size of objects in a bucket
To show the overall size of all objects in a given bucket, use one of the following commands:
You use the same command as for counting objects:
aws --profile <region> \
s3 ls \
--recursive \
--summarize \
s3://<bucket>
Total Size
, at the end of the output.
By default, the total size is given in bytes.
If you prefer more sensible units, add the --human-readable
option:
aws --profile <region> \
s3 ls \
--recursive \
--summarize \
--human-readable \
s3://<bucket>
You could use the same command as for counting objects:
mc ls <region>/<bucket> \
--recursive \
--summarize
Total Size
, at the end of the output.
It is shown in KiB, MiB, GiB, or TiB, and the value shown may thus be approximate.
Alternatively, you may also use the du
subcommand:
mc du <region>/<bucket>
s3cmd -c ~/.s3cfg-<region> \
du \
s3://<bucket>