S3 List Objects Command — Filtering by Size with AWS CLI
Network Topology
A data scientist runs the above AWS CLI command. What does the command do?
Quick Answer
The correct answer is that the command lists objects larger than 1,000,000 bytes under the data/ prefix. This is because the AWS CLI `s3api list-objects` command with `--query` uses JMESPath to filter results, and the expression `Size > '1000000'` compares the object size in bytes, not in binary megabytes (where 1 MB equals 1,048,576 bytes). On the AWS Certified Machine Learning Specialty MLS-C01 exam, this tests your ability to parse CLI output and understand that S3 object sizes are always returned in bytes, a common trap where candidates confuse decimal megabytes with binary megabytes. The command returns only the object keys, not counts or dates, making it essential for data scientists to efficiently locate large files for preprocessing. A helpful memory tip: think of the filter as "greater than one million bytes" rather than "greater than one megabyte" to avoid the 48,576-byte gap.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
It lists objects larger than 1,000,000 bytes under the data/ prefix.
The AWS CLI command `aws s3api list-objects --bucket your-bucket --prefix data/ --query 'Contents[?Size > `1000000`].[Key]'` lists the keys (names) of objects in the bucket under the 'data/' prefix whose size is greater than 1,000,000 bytes. The `--query` uses JMESPath to filter objects where Size > 1000000 and then projects the Key field. Option B is incorrect because it states 'counts', but the command returns keys, not a count. Option C is incorrect because it filters by size, not by date. Option D is incorrect because 1,000,000 bytes is not exactly 1 MB (which is 1,048,576 bytes), so the description 'larger than 1 MB' is inaccurate; the command uses bytes, not MB.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
It lists objects larger than 1,000,000 bytes under the data/ prefix.
Why this is correct
The --query filters Size > '1000000', which is 1,000,000 bytes.
- ✗
It counts the number of objects larger than 1 MB.
Why it's wrong here
It returns keys, not counts.
- ✗
It lists objects created after January 2023.
Why it's wrong here
No date filtering is applied.
- ✗
It lists objects larger than 1 MB in size.
Why it's wrong here
1 MB is 1,048,576 bytes; the filter uses 1,000,000 bytes, which is ~0.95 MB.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
One of 1,672 original MLS-C01 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on MLS-C01
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A data scientist is exploring log files stored in S3. They ran the above AWS CLI command. What does the output indicate about the data, and what EDA step should be taken next?
medium- A.All log files are about 150KB-200KB in size.
- B.There are 3 objects in the bucket under the prefix.
- ✓ C.There are 3 log files larger than 100KB in the specified prefix.
- D.The prefix 'logs/2023/' contains exactly 3 objects.
Why C: The command `aws s3api list-objects-v2 --bucket <bucket> --prefix logs/2023/ --query 'Contents[?Size > `100000`].[Key,Size]' --output text` lists objects under the specified prefix with a size greater than 100000 bytes (≈100 KB). The output shows three objects, indicating there are three log files larger than 100 KB. Option A is incorrect because the output does not provide exact size ranges (e.g., 150KB-200KB); it only indicates files exceeding 100 KB. Option B is incorrect because the command filters by size, so it does not count all objects in the bucket under the prefix. Option D is incorrect because it states the prefix contains exactly three objects, but the command only returns objects larger than the threshold; there may be additional smaller objects not shown.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This MLS-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLS-C01 exam.