10.1
Buckets, Objects and Keys
Naming rules, keys and prefixes, object size and multipart upload, metadata, tags and consistency.
20 min Reading + animations
Tip: tap or hover any dotted-underlined term to see what it means.
By the end of this lesson you will be able to
- Explain what Amazon S3 is, why it is object storage rather than a disk or a file system, and name the everyday jobs it does: photo and media storage, backups, log archives, data lakes, software downloads and static websites.
- Explain why a bucket has a globally unique name but lives in one Region, apply every bucket naming rule, and choose between the shared global namespace and your account regional namespace.
- Describe objects, keys and prefixes, and explain why S3 has no real folders even though the console shows them.
- State the size limits (50 TB per object, 5 GB per PUT, 10,000 parts of 5 MiB to 5 GiB), decide when to use multipart upload, and calculate part counts and part sizes.
- Tell system metadata, user metadata, tags and the version ID apart, and say which of them can change after upload.
- Explain S3’s strong read-after-write consistency, what is still eventually consistent, and how conditional writes stop two writers from overwriting each other.
- List what you pay for in S3 and estimate a simple monthly bill.
#What Amazon S3 is
Amazon S3 (Simple Storage Service) is AWS’s object storage service, and one of the oldest and most used building blocks of AWS. It is sold as storage that scales without limit: you never create a volume, choose a size or add capacity. You put data in, you pay for what is stored, and S3 grows with you. Many websites use S3 as their backbone, and many AWS services use it underneath: EBS snapshots and AMIs are kept in S3, CloudTrail and load balancers write their logs to S3, and Athena, Glue and Redshift read data straight from it.
#Object storage, not a disk
Lesson 5.4 compared the three kinds of storage. S3 is the third kind:
| Block (EBS) | File (EFS) | Object (S3) | |
|---|---|---|---|
| What you get | A raw disk for one instance | A shared file system | A bucket of whole objects |
| How you reach it | Mounted as a device | Mounted over NFS | HTTP(S) API calls: PUT, GET, DELETE, list |
| Change part of a file | Yes, any block | Yes, any byte | No: replace the whole object |
| Size | You provision it | Grows by itself | Grows by itself, no limit on the bucket |
| Scope | One AZ | A Region | A Region, reachable from anywhere |
Because S3 talks HTTP, every object has an address, and a browser, a phone app, a Lambda function or another AWS service can reach it without mounting anything. That is what makes it the default place to put files that many systems share.
#What people use S3 for
| Use case | Real-life example | Why S3 and not something else |
|---|---|---|
| Media hosting | A Dhaka e-commerce shop stores 200,000 product photos; a news site stores every photo and video it has published | Served over HTTP straight to browsers (usually through CloudFront, chapter 11); an EBS volume would need a server in front and cannot be shared |
| Backup and storage | A school’s student-records database dumps a nightly backup | Pay per GB, nothing to provision, data copied across several AZs |
| Disaster recovery | A bank replicates its backups to a bucket in another Region (lesson 10.4) | If a whole Region fails, the copy is elsewhere |
| Archive | A hospital keeps 10 years of X-ray scans; a stock exchange keeps seven years of trading records | The Glacier storage classes cost a fraction of a cent per GB-month (lesson 10.5) |
| Log archive | Every web server, load balancer and CloudTrail trail of a bank writes logs to one bucket for audit | Unlimited, cheap, append-only by design, and queryable later with Athena |
| Data lake and analytics | A ride-sharing company drops every trip record into S3 and runs Athena or Redshift on it | Storage and compute are separate: keep everything cheaply, run queries only when needed |
| Hybrid cloud storage | A factory’s on-premises file server tiers old files to S3 through Storage Gateway (chapter 12) | The data centre keeps working with files while the cloud holds the bulk |
| Application hosting and software delivery | A games studio hosts its 3 GB installer and patches for download | Millions of downloads with no servers to scale |
| Static website | A small business site of HTML, CSS and images (lesson 10.3) | No server at all for pages that never change per user |
#Buckets
A bucket is the container that holds objects. The slides call buckets “directories”, which is a useful first picture but not quite right: a bucket is a top-level container with a name, a Region, an owner and its own settings (versioning, encryption, policies, lifecycle rules), and it cannot be nested inside another bucket.
#A global name, a regional home
Two facts about buckets confuse almost everyone at first, and the exam tests both:
- The name is global. A general purpose bucket name must be unique across every AWS account in every Region of the partition. (A partition is a group of Regions: the standard
awspartition, China, GovCloud (US) and the European Sovereign Cloud each have their own namespace.) Once you owndhaka-shop-photos-example, nobody else can create it, anywhere, until you delete it. - The bucket lives in one Region. You pick the Region when you create it, and its objects are stored only there unless you copy or replicate them yourself. You cannot move a bucket to another Region or rename it later.
The S3 console adds to the confusion: it shows the buckets of all Regions in one list, so S3 looks like a global service. It is not. Every bucket has a Region, and requests go to that Region’s endpoint.
A global name, a regional home
A bucket’s name is checked against every account in the partition, but the bucket and its data live in the one Region you pick.
Scenario
A Dhaka shop creates dhaka-shop-photos-example in Mumbai for its product photos.
You ask for the name dhaka-shop-photos-example. Bucket names share one namespace across every account and every Region in the partition, so S3 first checks that nobody anywhere owns it.
Why choose the Region carefully?
- Latency: a Dhaka shop serving customers in Bangladesh puts its bucket in
ap-south-1(Mumbai) orap-southeast-1(Singapore), not inus-east-1. - Cost: prices differ slightly by Region, and moving data between Regions is charged.
- Law and compliance: a bank or hospital may be required to keep data in a certain country; S3 guarantees objects do not leave the Region on their own.
A few more bucket facts worth knowing:
- Private by default. A new bucket and its objects can be read only by the owner’s account. Block Public Access is on by default and ACLs are disabled by default (lesson 10.2 covers access).
- Encrypted by default. Since January 2023 every new object is encrypted at rest with SSE-S3 unless you choose otherwise (lesson 10.8).
- Quota. An account can create 10,000 general purpose buckets by default (raised from 100 in November 2024) and can request more. There is no limit on objects or bytes per bucket.
- The bucket pays. The owner’s account is billed for storage and requests, and the bucket is the unit that usage reports add up.
#Naming rules
A general purpose bucket name must follow all of these rules:
- 3 to 63 characters long.
- Only lowercase letters, digits, dots (
.) and hyphens (-). No uppercase, no underscores, no spaces. - Begin and end with a letter or a digit, and never two dots side by side.
- Not formatted like an IP address, such as
192.0.2.10. - Not start with the reserved prefixes
xn--,sthree-oramzn-s3-demo-. - Not end with the reserved suffixes
-s3alias(access point aliases),--ol-s3(Object Lambda access point aliases),.mrap(Multi-Region Access Points),--x-s3(directory buckets) or--table-s3(table buckets). The suffix-anis allowed only for names in your account regional namespace.
Why so strict? Because the bucket name becomes part of a DNS host name: dhaka-shop-photos-example.s3.ap-south-1.amazonaws.com. DNS names are case-insensitive and do not allow underscores, so neither do bucket names. Before March 2018, buckets in us-east-1 could have uppercase letters and underscores; a few of those old buckets still exist, but no new one can be created that way.
Try the rules yourself. The checker tests a name against every rule, warns about dots and easy-to-guess names, and shows what the account regional suffix looks like.
Bucket name checker
Type a name or pick an example, choose where the name lives, then press Check. Every rule S3 applies to a general purpose bucket is tested one by one.
Namespace
Examples
Nothing is checked until you press Check.
#How a bucket is addressed
Every object has a URL. AWS uses three forms:
| Form | Example | Used for |
|---|---|---|
| Virtual-hosted style (the standard) | https://dhaka-shop-photos-example.s3.ap-south-1.amazonaws.com/photos/cake.jpg | SDKs, apps, browsers |
| Path style (legacy) | https://s3.ap-south-1.amazonaws.com/dhaka-shop-photos-example/photos/cake.jpg | Old code; still works, but AWS recommends virtual-hosted style |
| S3 URI | s3://dhaka-shop-photos-example/photos/cake.jpg | The AWS CLI and many tools; not an HTTP address |
A website endpoint (…s3-website.ap-south-1.amazonaws.com) is a fourth, separate address that serves pages over plain HTTP; it belongs to lesson 10.3. Having a URL does not make an object public: a GET without permission gets 403 Access Denied.
#Objects and keys
An object is one item stored in a bucket: the data (the value, the bytes of the file) plus information about it. The slides call objects “files”, which is a good everyday word, as long as you remember that S3 never opens or understands them.
#The key is the full name
Each object has exactly one key, its name inside the bucket. The key is the full path, not just the file name:
s3://dhaka-shop-photos-example/index.html→ keyindex.htmls3://dhaka-shop-photos-example/photos/2026/eid/cake.jpg→ keyphotos/2026/eid/cake.jpg
A key is any UTF-8 string up to 1,024 bytes (about 1,024 Latin characters; Bengali characters take 3 bytes each). It is case sensitive: Photos/cake.jpg and photos/cake.jpg are two different objects. The bucket + key (and, with versioning, the version ID) identify an object uniquely. You can think of S3 as one huge map from “bucket + key + version” to the object.
Safe key characters are letters, digits and ! - _ . * ' ( ). Characters such as & $ @ = ; : + , ? and spaces work but must be URL-encoded. Avoid the backslash, braces, square and angle brackets, the caret, percent sign, backtick, quotation mark, tilde, hash and pipe, and non-printable characters. Also avoid path segments that are just . or .., which tools may “normalise” away.
#No folders: just prefixes
S3 has no directories. A general purpose bucket is a flat namespace: a long sorted list of keys. The slash in photos/2026/eid/cake.jpg is an ordinary character. The part up to the last slash, photos/2026/eid/, is called the prefix, and the rest, cake.jpg, is the object name. Key = prefix + object name.
The console “tricks you”, as the slides put it, into seeing folders. When you open a bucket, it asks S3 to list keys with the delimiter /. S3 then groups every key by the text up to its first slash and returns those groups as common prefixes, which the console draws as folders. Clicking a folder is just another list call with a longer prefix.
A key is just a long name
A bucket is a flat list of keys. Slashes are ordinary characters; the console turns them into folders only when it draws the list.
Scenario
What the bucket really holds
| Key (the full name) | Size |
|---|---|
| index.html | 4 KB |
| logs/2026-10-25.gz | 2 MB |
| photos/2025/logo.png | 30 KB |
| photos/2026/eid/cake.jpg | 3 MB |
| photos/2026/eid/sweets.jpg | 2 MB |
This bucket holds five objects. Each one has a single key, and the key is the whole string, slashes included. There is no directory tree behind it.
This has practical consequences:
- Create folder in the console uploads a zero-byte object whose key ends in
/, such asphotos/2027/. The console hides it; the CLI and SDKs see it as a normal object. - A “folder” that was never created that way exists only while at least one key starts with its prefix. Delete the last such object and the folder disappears.
- There is no rename, for a folder or for an object. Renaming
photos/toimages/means copying every object to a new key and deleting the old one: two requests per object. Plan key names before you load millions of objects. - Permissions and lifecycle rules can still target “folders”, because they match on prefix: a policy resource
arn:aws:s3:::dhaka-shop-photos-example/photos/*covers every key that starts withphotos/. - Prefixes also matter for performance: S3 scales request rates per prefix (3,500 writes and 5,500 reads per second per prefix), so spreading busy keys across prefixes raises the ceiling. Lesson 10.6 covers it.
#How big can an object be?
- An object can be anything from 0 bytes up to 50 TB.
- One PUT request can upload at most 5 GB. Anything bigger must use multipart upload.
#What an object carries
Besides its key and its data, every object carries descriptive information. Knowing which piece is which, and which can change, answers a surprising number of exam questions.
Everything that makes up one object
Bucket + key (+ version ID) find the object. Inside it are the data and three kinds of descriptive information.
Scenario
Every object lives in exactly one bucket. The bucket fixes the Region and the account that pays for storage and requests.
#Metadata: system and user
Metadata is a set of name–value pairs that describe the object. The notes divide it into two kinds:
- System metadata is defined by S3. Some of it only S3 can set, such as
Date,Content-Length(the size),Last-Modifiedand theETag. Some of it you choose at upload, such asContent-Type(image/jpeg, so browsers display the photo instead of downloading it),Cache-Control, the storage class and the encryption settings. - User metadata is your own pairs, sent as HTTP headers that start with
x-amz-meta-, for examplex-amz-meta-photographer: rahim. S3 stores the names in lowercase and returns them on every GET and HEAD. User metadata is limited to 2 KB per object, and the whole PUT request header to 8 KB.
The important rule: metadata cannot be edited after upload. To change it, you copy the object onto itself (or to a new key) with the new metadata, which creates a new object, or a new version if versioning is on. The console’s “Edit metadata” does exactly that behind the scenes.
#Tags
Object tags are up to 10 key–value pairs per object, such as team=catalog and status=live. A tag key can be up to 128 characters and a value up to 256, and both are case sensitive. Unlike metadata, tags are stored beside the object and can be added, replaced or removed at any time without touching the data.
Tags are useful because other parts of AWS can act on them:
- Security: an IAM or bucket policy can allow access only to objects tagged
classification=public(lesson 10.2). - Lifecycle: a rule can move only objects tagged
phototype=rawto Glacier after 90 days (lesson 10.5). - Analysis and cost: Storage Class Analysis, CloudWatch metrics and S3 Batch Operations can filter or act on tags.
User metadataObject tags
- Set only at upload, as
x-amz-meta-*headers - Cannot be changed without copying the object
- Up to 2 KB in total
- Returned with every GET and HEAD
- For information your application reads: photographer, original file name, checksum of the source
- Can be added or changed any time
- Changing them does not create a new object or version
- Up to 10 pairs per object
- Read with a separate tagging call
- For rules: access control, lifecycle filters, analysis, Batch Operations
#Version ID
When versioning is enabled on a bucket (lesson 10.4), every write to a key gets a new, unique version ID, such as 3HL4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY, and older versions are kept. You can then read or restore any earlier version. Without versioning, objects have the version ID null, and a new PUT simply replaces the old object. Objects that existed before you enabled versioning also keep the version ID null.
#ETag and checksums
The ETag is a fingerprint of the object’s content that S3 returns on every PUT, GET and HEAD. For an object uploaded with one PUT and not encrypted with SSE-KMS, the ETag is the MD5 of the data, so a client can compare it with its own hash. For a multipart upload the ETag is computed from the parts and ends with -N, the number of parts, so it is not the MD5 of the whole file. Do not use it as a file hash in that case.
For real integrity checks, S3 supports additional checksums (CRC-64/NVME, CRC-32, CRC-32C, SHA-1, SHA-256). Since late 2024 the AWS SDKs and the CLI calculate a CRC checksum by default on upload, and S3 verifies it before it stores the object, so corruption on the way is caught.
#Uploading: one PUT or many parts
#One PUT, up to 5 GB
The simplest upload is a single PUT request with the whole file in its body. It is perfect for small objects: a product photo, a JSON document, a log file. It has two weaknesses for big files: one request is one stream, which rarely uses a fast link fully, and if the connection drops at 90%, S3 keeps nothing and the whole file must be sent again. A single PUT is also capped at 5 GB.
#Multipart upload
Multipart upload splits one object into parts, uploads them independently (usually in parallel), and joins them into one object at the end. The notes give the rule of thumb: recommended above 100 MB, mandatory above 5 GB.
Start
The client sends a create-multipart-upload request with the key and any metadata, tags and storage class. S3 returns an upload ID that ties the parts together.
Upload the parts
The client uploads parts, each with a part number from 1 to 10,000, in any order and in parallel. S3 answers each part with an ETag. A part that fails is simply uploaded again with the same number.
Complete
The client sends the list of part numbers and their ETags. S3 joins the parts in part-number order into one object, which appears in the bucket only now. If the client instead aborts the upload, S3 deletes the parts.
The limits:
| Item | Limit |
|---|---|
| Parts per upload | 1 to 10,000 |
| Part size | 5 MiB to 5 GiB (the last part can be smaller) |
| Largest object | 10,000 × 5 GiB = 48.8 TiB (the “50 TB”) |
| Single PUT, for comparison | 5 GiB |
Why multipart helps:
- Speed: several parts in flight at once use more of your bandwidth (lesson 10.6 goes further, with Transfer Acceleration and byte-range downloads).
- Resilience: a network error costs one part, not the whole file. This is the notes’ exam trick: “uploads keep failing on an unreliable network” → multipart upload, because only the failed part is retried.
- Pause and resume: parts already uploaded stay stored until you complete or abort, so a laptop can continue tomorrow.
- Unknown size: you can start uploading a stream, such as a live video or a database dump being generated, before you know its final size.
You rarely call these steps by hand. aws s3 cp and the SDKs’ transfer managers switch to multipart automatically above a threshold (8 MB by default in the CLI) and choose part sizes for you. Multipart upload is also the first of the three application-level paths in lesson 10.12, which puts it next to pre-signed URLs and Batch Operations.
#The part maths
Two calculations come up again and again:
- How many parts? Divide the file size by the part size and round up. A 6 GB backup with 100 MiB parts: 6,000,000,000 ÷ 104,857,600 = 57.2, so 58 parts.
- What is the smallest part size I can use? Divide the file size by 10,000. A 1.2 TB scan archive needs parts of at least 1,200,000,000,000 ÷ 10,000 = 120,000,000 bytes, about 115 MiB. With 100 MiB parts it would need 11,445 parts, over the limit, so the upload would fail.
Try both in the planner, then make part 3 fail, and compare what a single PUT and a multipart upload have to send again.
Upload planner: one PUT or multipart?
Pick a file, a method, a part size and a link speed. Press Upload to check S3’s limits and watch the parts travel. Try making part 3 fail, or walking away before the upload completes.
File
Method
Link
Nothing moves until you press Upload.
#When an upload is never completed
If a client starts a multipart upload and then crashes or simply never sends “complete”, the parts stay in the bucket. They are invisible in normal listings and the console’s object list, but you pay for their storage until the upload is aborted. In a busy bucket with flaky clients this can quietly grow to terabytes. The fix is a lifecycle rule that aborts incomplete multipart uploads after a few days (lesson 10.5). You can see them with aws s3api list-multipart-uploads, and S3 Storage Lens reports them (lesson 10.7).
Self-checkQuestion
A video editor uploads a 7 GB file to S3 with one PUT request. What happens?
#Consistency: what a reader sees after a write
#Strong read-after-write
Since December 2020, S3 gives strong read-after-write consistency for every object operation, in every Region, automatically and at no extra cost:
- After a successful PUT of a new object, any GET returns it and any list includes it.
- After a successful overwrite, any GET returns the new data, never the old.
- After a successful DELETE, any GET returns 404 and any list leaves it out.
- Reads of metadata (HEAD), tags and ACLs are strongly consistent too.
“After” means: the read started after the write returned success. A read that overlaps a write may get the old or the new data, but never a mix: each update of a key is atomic.
Read after write: what a reader sees
Two app servers share one bucket. Since December 2020, a successful write is visible to every later read and list, at no extra cost.
Scenario
Server A overwrites prices.json with today’s Eid discount prices.
#Two writers, one key
Strong consistency does not mean locking. If two clients PUT the same key at about the same time, S3 keeps the request with the latest timestamp (last writer wins), and the other update is lost without any error. Updates across several keys are not atomic either: S3 has no transactions.
Since 2024 S3 offers conditional writes on general purpose buckets:
If-None-Match: *→ write only if the key does not exist yet. Two clients creatingorders/1001.jsonat once: one wins, the other gets 412 Precondition Failed instead of overwriting.If-Match: <etag>→ write only if the object is still the version I read. This is optimistic locking: read, change, write back with the ETag, and retry if you get 412.
A bucket policy can even require these headers on every write. For anything that needs real transactions, such as stock counts or seat bookings, keep the state in a database (DynamoDB, RDS) and keep only the files in S3.
#What is still eventually consistent
- Bucket configuration. Turning on versioning, changing a policy, or deleting a bucket takes a short time to spread through S3. AWS recommends waiting about 15 minutes after enabling versioning before writing objects that must be versioned, and a deleted bucket may still appear in a bucket list for a while.
- Replication to another bucket is asynchronous (lesson 10.4): the copy in the other Region appears seconds to minutes later.
#What S3 costs
S3 has no upfront fee and no minimum. The bill has a few components, and the exam expects you to know which are free.
| Component | What you pay | Example price (S3 Standard, us-east-1, Oct 2026) |
|---|---|---|
| Storage | Per GB-month, by storage class | about $0.023 per GB-month for the first 50 TB, a little less above |
| Requests | Per 1,000 requests, by type and class | PUT, COPY, POST, LIST: about $0.005 per 1,000; GET: about $0.0004 per 1,000; DELETE: free |
| Data transfer in | From the internet into S3 | Free |
| Data transfer out | From S3 to the internet | First 100 GB per month free (shared across AWS), then about $0.09 per GB |
| Transfer to AWS services | To CloudFront; to EC2 or other services in the same Region | Free (CloudFront charges for its own delivery) |
| Transfer between Regions | Copies and replication to another Region | Charged per GB |
| Retrieval | Reading from the IA and Glacier classes | Per GB retrieved (lesson 10.5) |
| Management features | Inventory, Storage Class Analysis, advanced Storage Lens, Replication Time Control, Transfer Acceleration, Object Lambda | Per object, per GB or per request |
Prices change and differ by Region, so use the AWS Pricing Calculator for real numbers. What matters for design is the shape of the bill.
#What goes wrong
| Symptom | Likely cause | Fix |
|---|---|---|
BucketAlreadyExists (409) when creating a bucket | Another account, in any Region, owns the name | Choose a more specific name, or use your account regional namespace |
InvalidBucketName | Uppercase, underscore, IP-like, reserved prefix or suffix, wrong length | Follow the naming rules; the checker above shows which one |
HTTPS certificate error for www.example.com.s3.amazonaws.com | Dots in the bucket name do not match the wildcard certificate | Avoid dots, or put CloudFront in front (lesson 10.3) |
| “Your proposed upload exceeds the maximum allowed size” | A single PUT larger than 5 GB | Use multipart upload (aws s3 cp does it automatically) |
| Multipart upload fails with too many parts | Part size too small for the file: more than 10,000 parts | Part size ≥ file size ÷ 10,000 |
| Storage bill grows, but the bucket looks small | Incomplete multipart uploads, or old versions in a versioned bucket | Lifecycle rule to abort incomplete uploads and expire noncurrent versions (lesson 10.5) |
| An empty “folder” keeps appearing in the console | A zero-byte prefix/ object created by Create folder or a tool | Delete that object if you do not want it |
| A folder vanished after deleting files | It was only a prefix of the deleted keys | Nothing is lost; upload again and it reappears |
| Two keys that look the same | Case differs (Photos/ vs photos/) or a double slash | Build keys in one helper function, lowercase by convention |
| One user’s update overwrote another’s | Concurrent PUTs to one key: last writer wins | Conditional writes (If-Match, If-None-Match), or keep the state in a database |
| Browser downloads a photo instead of showing it | Wrong or missing Content-Type | Set it at upload; to fix existing objects, copy them onto themselves with new metadata |
| Uploads land in a bucket you do not own | You deleted a bucket that clients still reference, and someone re-created the name | Keep referenced buckets; use the account regional namespace |
#S3 in system design
The pattern that appears in almost every architecture: store the bytes in S3, store the facts about them in a database. S3 is excellent at holding very large numbers of objects and serving them to many readers. It is not a database: it has no queries over object contents, no transactions and no partial updates.
- Photo or document app. The app saves
products/shirt-42.jpgin S3 and a row in DynamoDB or RDS with the key, the owner, the price and the upload time. Pages read the database, then load images from S3 through CloudFront. Users can upload directly to S3 with a pre-signed URL so files never pass through the web servers (lessons 10.9 and 10.12). - Log archive. Load balancers, CloudTrail and applications write to keys such as
logs/app/2026/10/25/web-1.gz. Date-based prefixes make it cheap to process one day, and lifecycle rules move old logs to Glacier. A bank’s auditors can add Object Lock so logs cannot be altered (lesson 10.9). - Data lake. Raw data lands in
raw/, cleaned data inclean/, query-ready files incurated/, often partitioned in the key itself (trips/year=2026/month=10/day=25/). Athena, Spark and Redshift Spectrum read straight from S3, so storage and compute scale separately. - Key design. Decide the key layout before loading data: there is no rename, prefixes drive lifecycle rules and permissions, and request rates scale per prefix (lesson 10.6). Avoid putting secrets or personal data in keys; they show up in logs and URLs.
- Large uploads. Clients upload big files with multipart upload, ideally directly to S3, and a lifecycle rule cleans up abandoned uploads.
#Exam patterns
| The question says… | Think… |
|---|---|
| “Same bucket name in two Regions” | Impossible in the shared namespace: names are global |
| A bucket name with capitals or an underscore | That option is wrong |
| “Store unlimited files, accessible over HTTP, durable, cheap” | S3 |
| “Upload a 10 GB file” / “uploads fail on an unreliable network” | Multipart upload (mandatory above 5 GB; retries only the failed part) |
| “Maximum object size” | 50 TB today (older questions: 5 TB) |
| “Read immediately after write returns old data?” | No: strong read-after-write consistency since 2020 |
| “Categorise objects for access control or lifecycle without re-uploading” | Object tags |
| “Custom information stored with the object at upload” | User metadata, x-amz-meta-* |
| “Charges grow, bucket looks empty” | Incomplete multipart uploads → lifecycle abort rule |
| “Cheapest way to reduce S3 data transfer cost to users” | CloudFront in front of S3 (S3 → CloudFront transfer is free) |
#Try it yourself
These commands use the AWS CLI v2 with a profile allowed to use S3. Replace the bucket names with your own; the -example names here are placeholders.
Create a bucket in Mumbai, and check where it lives:
# Outside us-east-1 you must repeat the Region as a LocationConstraint
aws s3api create-bucket --bucket dhaka-shop-photos-example \
--region ap-south-1 \
--create-bucket-configuration LocationConstraint=ap-south-1
aws s3api get-bucket-location --bucket dhaka-shop-photos-example
# The same, in your account regional namespace (only your account can ever own this name)
aws s3api create-bucket --bucket shop-photos-111122223333-ap-south-1-an \
--bucket-namespace account-regional \
--region ap-south-1 \
--create-bucket-configuration LocationConstraint=ap-south-1
Upload an object with a content type, user metadata and tags, then read its metadata without downloading it:
aws s3api put-object --bucket dhaka-shop-photos-example \
--key photos/2026/eid/cake.jpg --body cake.jpg \
--content-type image/jpeg \
--metadata photographer=rahim,shoot=eid-2026 \
--tagging 'team=catalog&status=live'
aws s3api head-object --bucket dhaka-shop-photos-example --key photos/2026/eid/cake.jpg
aws s3api get-object-tagging --bucket dhaka-shop-photos-example --key photos/2026/eid/cake.jpg
See the flat key list, and the folders the console would draw:
aws s3 ls s3://dhaka-shop-photos-example/ --recursive # every key, no folders
aws s3 ls s3://dhaka-shop-photos-example/photos/ # PRE 2026/ = a common prefix
aws s3api list-objects-v2 --bucket dhaka-shop-photos-example \
--prefix photos/ --delimiter / # CommonPrefixes in the JSON
Change metadata (there is no edit: copy the object onto itself) and change tags (in place):
aws s3api copy-object --bucket dhaka-shop-photos-example \
--key photos/2026/eid/cake.jpg \
--copy-source dhaka-shop-photos-example/photos/2026/eid/cake.jpg \
--metadata-directive REPLACE \
--content-type image/jpeg --metadata photographer=karim
aws s3api put-object-tagging --bucket dhaka-shop-photos-example \
--key photos/2026/eid/cake.jpg \
--tagging 'TagSet=[{Key=team,Value=catalog},{Key=status,Value=archived}]'
A multipart upload by hand, and the clean-up commands:
aws s3api create-multipart-upload --bucket dhaka-shop-photos-example \
--key backups/db-2026-10-25.sql.gz # returns an UploadId
aws s3api upload-part --bucket dhaka-shop-photos-example \
--key backups/db-2026-10-25.sql.gz --part-number 1 \
--body part-001 --upload-id "$UPLOAD_ID" # returns the part's ETag
aws s3api complete-multipart-upload --bucket dhaka-shop-photos-example \
--key backups/db-2026-10-25.sql.gz --upload-id "$UPLOAD_ID" \
--multipart-upload file://parts.json # {"Parts":[{"PartNumber":1,"ETag":"..."}]}
aws s3api list-multipart-uploads --bucket dhaka-shop-photos-example # find abandoned ones
aws s3api abort-multipart-upload --bucket dhaka-shop-photos-example \
--key backups/db-2026-10-25.sql.gz --upload-id "$UPLOAD_ID"
The high-level command does all of that for you, in parallel, and you can tune when it switches to multipart:
aws configure set default.s3.multipart_threshold 64MB
aws configure set default.s3.multipart_chunksize 16MB
aws s3 cp ./db-2026-10-25.sql.gz s3://dhaka-shop-photos-example/backups/
Create an object only if the key does not exist yet (a conditional write):
aws s3api put-object --bucket dhaka-shop-photos-example \
--key orders/1001.json --body 1001.json --if-none-match '*'
# Run it twice: the second call fails with 412 Precondition Failed
Clean up when you are done (empty, then delete; remember that a deleted name can be taken by someone else):
aws s3 rm s3://dhaka-shop-photos-example --recursive
aws s3api delete-bucket --bucket dhaka-shop-photos-example --region ap-south-1
#Summary
Key takeaways
- S3 is object storage: whole objects over HTTP, no capacity to provision, eleven nines of durability. Use it for media, backups, archives, logs, data lakes, downloads and static sites.
- A bucket lives in one Region, but its name is unique across all accounts and Regions of the partition. The console looks global; buckets are regional. Names and Regions cannot change.
- Naming: 3–63 characters, lowercase letters, digits, dots and hyphens, start and end with a letter or digit, no
.., not an IP address, noxn--/sthree-/amzn-s3-demo-prefixes, no-s3alias/--ol-s3/.mrap/--x-s3/--table-s3suffixes. Uppercase or underscore = wrong option. Avoid dots. - Account regional namespace (2026): names ending in
-<account>-<region>-anthat only your account can ever create. Do not delete buckets that code still references. - An object = key + data + metadata + tags (+ version ID). The key is the full name, up to 1,024 bytes, case sensitive. No folders: prefixes plus the
/delimiter; Create folder makes a zero-byte object; there is no rename. - Sizes: object 0 B to 50 TB (older figure 5 TB); single PUT ≤ 5 GB; multipart recommended > 100 MB, required > 5 GB; 10,000 parts of 5 MiB–5 GiB. Part size ≥ file ÷ 10,000.
- Multipart = parallel speed, retry only the failed part, resume later. Abort or lifecycle-clean incomplete uploads, because their parts are billed.
- System metadata (S3’s), user metadata (
x-amz-meta-*, 2 KB, fixed at upload; change = copy), tags (10 pairs, changeable, used by policies and lifecycle), version ID (nullwithout versioning). Single-part ETag = MD5; multipart ETag ends in-N. - Strong read-after-write consistency for PUT, overwrite, DELETE and list since Dec 2020; last writer wins with no locking; conditional writes (
If-None-Match,If-Match) prevent lost updates; bucket configuration is eventually consistent. - Costs: storage GB-month, requests, data transfer out, retrieval and management features. Transfer in is free, and so is transfer to CloudFront or to services in the same Region.
Answer on your own first, then read the explanation, even when you got it right.
Self-checkQuestion
A shop needs to store millions of product photos that browsers and a mobile app will fetch over HTTP. The amount will keep growing and nobody wants to manage disk sizes. Which storage fits best?
Self-checkQuestion
Which statement about S3 buckets is correct?
Self-checkQuestion
Which of these is a valid general purpose bucket name?
Self-checkQuestion
Which two bucket names would S3 reject?
Choose 2
Self-checkQuestion
What is an S3 object key?
Self-checkQuestion
What does the Create folder button in the S3 console actually create?
Self-checkQuestion
What is the maximum size of a single S3 object today?
Self-checkQuestion
What is the largest object you can upload with one PUT request?
Self-checkQuestion
An application stores the name of the photographer with each uploaded photo as user-defined metadata. Which HTTP header prefix does it use?
Self-checkQuestion
Which two statements about S3 object tags are true?
Choose 2
Self-checkQuestion
Versioning has never been enabled on a bucket. What is the version ID of its objects?
Self-checkQuestion
An application overwrites prices.json and receives 200 OK. One millisecond later another server sends a GET for prices.json. What does it receive?
Self-checkQuestion
A company uploads a 40 GB database backup every night from its data centre over an unreliable internet link. The upload often fails near the end and starts again from the beginning. What should the architect recommend?
Self-checkQuestion
A company wants buckets named acme-invoices in both us-east-1 and eu-west-1, in the shared global namespace, so that application code can use the same name everywhere. What should the architect tell them?
Self-checkQuestion
A team deleted an old bucket that an earlier version of its mobile app still uploads to. Weeks later it finds that those uploads are going to a bucket owned by an unknown account. Which two practices would have prevented this?
Choose 2
Self-checkQuestion
Two web servers update the same key, cart/42.json, at almost the same moment. Sometimes one customer’s change is lost. What is the best fix while keeping the cart in S3?
Self-checkQuestion
A company hosts a website from a bucket named www.example.com. Its developers try to fetch files over HTTPS from https://www.example.com.s3.us-east-1.amazonaws.com and get a certificate error. Why?
Self-checkQuestion
A data team says S3 folders work just like folders on a server. Which two statements correct them?
Choose 2
Self-checkQuestion
Which two are real benefits of multipart upload?
Choose 2
Self-checkQuestion
A 6 GB file (6,000,000,000 bytes) is uploaded with multipart upload and a part size of 100 MiB (104,857,600 bytes). How many parts are uploaded?
Self-checkQuestion
A hospital uploads a 1.2 TB scan archive (1,200,000,000,000 bytes) with a part size of 100 MiB, and the upload fails. What is the problem and the smallest part size that would work?
Self-checkQuestion
A bucket holds 400 GB in S3 Standard at about $0.023 per GB-month. What is the monthly storage charge?
Self-checkQuestion
A shop’s bucket sends 300 GB per month directly to customers on the internet. The first 100 GB per month are free and the next tier costs about $0.09 per GB. What is the transfer-out charge?
Self-checkQuestion
Which two of these appear as charges on an S3 bill?
Choose 2
Self-checkQuestion
An S3 bucket’s storage charge keeps rising, but listing the bucket shows only a few small objects and versioning is off. What is the most likely cause, and the fix?
Self-checkQuestion
A team must rename the prefix photos/ to images/ in a bucket that holds 2 million objects under photos/. What does S3 have to do?
Self-checkQuestion
A script enables versioning on a new bucket and immediately writes objects that must keep every version. Some of the first writes have no version history. What explains it?
Self-checkQuestion
Thousands of images were uploaded with the wrong Content-Type, so browsers download them instead of showing them. How do you fix the existing objects?
Self-checkQuestion
A developer compares the ETag of an object uploaded with aws s3 cp (a 2 GB file) with the MD5 hash of the local file, and they differ. The object is not corrupt. What is the explanation?
Self-checkQuestion
A colleague says: S3 is eventually consistent, so after uploading a new image the application must wait a few seconds before it lists the bucket, or the image may be missing. Is that right?
Self-checkQuestion
Which of the following is NOT system metadata of an S3 object?