Remember how I mentioned that S3's "object storage" doesn't support directories? Well, that's true, but there's some trickery involved that makes it feel like it does.
Directories are really great for organizing stuff. Storing everything in one giant bucket makes a big hard-to-manage mess. So, S3 makes your objects feel like they're in directories, even though they're not.
Keys inside of a bucket are just strings. And strings can have slashes, right? Right.
If you upload an object to S3 with the key users/john/profile.jpg, we can kind of pretend that the object is in a directory called users and a subdirectory called john. Not only that, but the S3 API actually provides tools that allow this illusion to thrive.
Let's say I create some objects with keys:
users/dan/profile.jpgusers/dan/friends.jpgusers/lane/profile.jpgusers/lane/friends.jpgpeople/matt/profile.jpgThen I can use the S3 API to list all the objects with the key prefix users/lane. It returns:
users/lane/profile.jpgusers/lane/friends.jpgor just everything with the prefix "users":
users/dan/profile.jpgusers/dan/friends.jpgusers/lane/profile.jpgusers/lane/friends.jpgIt feels like a hierarchy, without all the technical overhead of actually creating directories.
aws s3 ls s3://YOURBUCKET/backups/
Replace YOURBUCKET with the name of your bucket.
aws s3 ls s3://YOURBUCKET/backups/ > /tmp/s3_listing.txt
Run and submit the CLI tests.
You can delete the backups folder and its contents when you're done.