← Lessons/S3 — Object Storage
← S3 — Object Storage

List what's in the bucket

Learn

Listing what's there

aws s3 ls with no argument lists your buckets. Give it a bucket and it lists what's in it:

2026-11-02 17:58:21         22 hello.txt

Each line is the upload date and time, the size in bytes, and the key. That's the read half of the loop: the object came back out of the service, so it really is stored.

Keys with slashes show up as a PRE (prefix) line, one "folder" level at a time:

                           PRE logs/
2026-11-02 18:01:46          3 readme.txt

Add --recursive to list every key under the prefix in one go, the way you'd use find rather than ls on a disk.

Confirm the upload landed by listing the bucket's contents. Add a final line:

aws s3 ls s3://groundwork-data/

You'll see the object's size and key — proof it's really stored in S3, read straight back out of the service.

Interview prep

S3 is the most-used AWS service; expect to be asked the basics.

What's the difference between a bucket and an object in S3?

A bucket is a globally-named container; an object is a file stored in it under a key (its path). You create the bucket once, then put/get/list objects within it. Bucket names are globally unique across all of AWS; object keys only need to be unique within their bucket.

Why does the sandbox re-create the bucket in every step?

Each run here is a fresh, throwaway environment (no state carries over), so the script re-makes the bucket before using it. In real AWS the bucket persists — you'd create it once. Re-running a create on an existing bucket is also why idempotency matters in infrastructure tooling.

$ bash solution.sh
Loading...

Output

Run your solution to see its output here.