S3 buckets, keys and prefixes
Store a file without managing a disk
Amazon S3 is an object storage service. A bucket holds objects, each identified by a key. An object contains data and metadata, such as a content type. An application can save a product image or retrieve a report through an API without allocating a disk or maintaining a filesystem. Use a general purpose bucket in the illustrative commercial Region us-east-1; no account or deployment is needed for this chapter.
Keys are names, not directory paths
The key is the full case-sensitive name within a bucket. A prefix is the beginning of that name. Slashes are ordinary key characters that tools use to group names. photos/cat.jpg and photos/Cat.jpg are different keys. A bucket belongs to a Region; choose a name that satisfies the current naming rules and namespace of your bucket type. Names shown here are fictional labels, not confirmed available names.
Example: organize a tiny shop
Imagine three objects in one bucket. List with prefix photos/ to obtain only the two photo keys. The prefix photo is broader and can match other names such as photography.txt. No actual directory must exist. A delimiter such as / can group results into common prefixes.
photos/cat.jpgphotos/dog.jpgreports/sales.csvUpload, retrieve and list
A PUT stores bytes at a key, a GET retrieves an object, and ListObjectsV2 enumerates keys. Metadata can be inspected with HEAD. A successful write is visible to subsequent reads and listings under S3 strong consistency; this does not create a transaction across multiple keys. A PUT to an existing key replaces the current content (or adds a version when enabled). Listing can be paginated: follow continuation tokens until the response is no longer truncated.
Choose the storage model
Use S3 for independent blobs such as images, backups or exports. EBS provides block devices; EFS provides shared file semantics. A normal S3 object is not a disk sector or an ordinary mutable file: do not plan in-place edits or POSIX rename operations on general purpose buckets. Specialized bucket types have different semantics and are outside this baseline.
Practice and next step
On paper, add reports/2026.csv and photos-old/dog.jpg to the example. Predict which keys match photos/. Explain why an application should save the full key, not just the final filename. Next, decide which identities can read those objects.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
S3 buckets, keys and prefixes — knowledge check
Apply S3 concepts to fictional offline scenarios.
Which storage model fits independent product images retrieved by key?
Which key matches prefix photos/?
What should a client do when a list response is truncated?
What does a slash in a general purpose bucket key imply?
Which statement about a successful PUT is correct?