I was recently using the metrics under the management tab in the aws s3 console and notices that for a few of my buckets the NumberOfObjects (count / day) graph seemed to be way off. I had roughly 50 objects in each of these buckets and it was displaying over 100.

After some cli commands, I was able to get close to determining this number. Adding number of objects currently displayed + versions + deleted objects + parts of multipart uploads I was able to get consistently to the number displayed - 2.

For example, for two of my buckets: Bucket #1 displayed 186 objects in the cloudwatch metrics, however the console only showed 44 objects. There were 9 delete markers, 8 previous versions, and one multi-part 123 part upload. 44 + 9 + 8 + 123 = 184. Bucket #2 displayed 78 objects in the cloudwatch metrics. Console showed 8, with 22 previous versions, 8 delete markers, and one 38 part upload. 8 + 22 + 8 + 38 = 76.

This is the case for more than just these two buckets. What counts as an object in the s3 cloudwatch metrics? Am I on to something with my initial calculations or is this just a very unlikely coincidence?


I'm sure you're onto something.

It definitely makes sense that you are seeing everything in the bucket being counted as an object... they are all entries in the bucket's index.

As for the off-by-two error, the bucket policy, bucket ACL, website redirection configuration, lifecycle policy, event notification configuration, CORS... any of these or other "configuration" elements are potentially counted as objects, and multipart uploads might be counted as number of parts + 1 for some kind of logical "container."

This last part is speculation, since don't recall seeing it spelled out in the documentation... but given what's known from the outside -- that the bucket index (essentially a lexically-sorted database) and the backing store are discrete components -- it's entirely sensible that S3 would count everything that is in the bucket index when reporting its stats to CloudWatch, whether humans would naturally count them as "actual objects" or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.