Checking your sign-in…
This lesson is in Phase 1 — ₹399, one-time
Pay once with UPI, card or netbanking. Keep it forever. Your progress saves, so you can stop and come back.
← Back to all lessonsObject Store Lab — A File Cupboard
Phase 1 · The Data TierWhat this is and why it matters
An object store is a big file cupboard. You put a file in by giving it a name. You ask for the file back by using the same name. The cupboard does not care what is inside the file. A photo, a receipt, a video — to the cupboard, each one is just a named file.
A bucket is one named box inside the cupboard. Files live inside buckets. This lab uses one bucket called incoming. Think of a labelled drawer: the cupboard is the store, the drawer is the bucket, the files are the papers inside the drawer.
In this lab you run TWO cupboards on your own machine. You put fake receipt files into the first cupboard. A helper called the mirror copies every new file into the second cupboard by itself. You never copy anything twice. If the first cupboard breaks, the copy in the second cupboard is still there. That is the whole point: one copy is risky, two copies are safe.
All files in this lab are fake. Nothing here is a real receipt, a real order, or real money.
Test status
Syntax-checked only (20 November 2026). The compose file, the Dockerfile and the shell script were checked for correct syntax. This lab was not run end-to-end on this machine, because this machine has no Docker. Follow it on your own machine with Docker, and if a step fails, read the error first — that is the real skill.
v2 (20 November 2026): the stores are now Moto, not MinIO. MinIO's free images are no longer available to download, so this lab uses Moto instead — a free stand-in for Amazon S3 that speaks the same S3 language. The file commands are now the aws tool, not mc. Still syntax-checked only, not run end to end.
A note on that change, so you are not confused: older write-ups of this lab mention MinIO. MinIO was the old tool. This lab no longer uses it. If you search for MinIO, you will find a different tool with different commands — do not follow those steps here. Moto is the tool in this lab, and every command below uses Moto.
What this lab is
You will run two file stores on your own machine with Moto — a free S3-compatible stand-in that works the same way as the paid stores. You will put fake receipt files into the first store and watch them appear in the second store by themselves. All files are fake.
Words you need here
Read this list first. Every word below is used in the steps. Nothing here is used before it is defined.
- Docker — a tool that runs small sealed boxes on your machine. Each box holds one program and everything that program needs. You need Docker running before Step 1. How to check is in "What you need first" below.
- Container — one sealed box run by Docker. In this lab there are four boxes:
moto-a,moto-b,mirror, andawscli. Each box does one job. - Image — the recipe Docker uses to build a box. A box is a running image. The
awsclibox is built from a small image described in the fileDockerfile. - Service — one named job in the file
docker-compose.yml. Each service becomes one container. The four services here aremoto-a,moto-b,mirror, andawscli. - docker-compose.yml — a recipe file. It lists the four services, what image each one uses, and how they talk to each other. It lives in the folder
phase1/object-store-lab. - Dockerfile — a second recipe file. It tells Docker how to build the small
awsimage used by theawscliandmirrorboxes. It lives in the same folder. - mirror.sh — a small script file. It is the mirror's job list: wait for both stores, make the bucket on both sides, then copy new files from the first store to the second every 10 seconds. It lives in the same folder. You never run it yourself — the
mirrorbox runs it. - Object store — a big file cupboard. You store a file by a name and ask for it back by the same name.
- Bucket — a named box inside the store. Files live in buckets. This lab uses one bucket called
incoming. - Moto — a free stand-in for Amazon S3. S3 is a paid file-cupboard service. Moto speaks the same S3 language, so what you learn here transfers to the real thing. Moto keeps everything in memory: stop the lab and the files are gone. That is fine for learning.
- S3 — the name of the paid file-cupboard service this lab copies. You do not need an S3 account. Moto pretends to be S3 on your own machine.
- aws — the command tool for S3 stores. It works like the
cp(copy) andls(list) commands, but for buckets. Every command below says which store it talks to. - Endpoint — the address of one store. The first store's address inside the boxes is
http://moto-a:5000. The second store's address ishttp://moto-b:5000. The number5000is the door number the store listens on inside its box. - Port — a door number on a machine. On your own machine the first store is reached on door
9000and the second on door9010. Inside the boxes, both stores listen on door5000. That is why the commands below use5000: they run inside a box, not on your machine directly.
Which door is which — read this table first
There are two door systems in this lab, and they look alike. This table is the whole map. Keep it open while you do the steps.
| Door | Where it lives | Which store it reaches | When you use it | |---|---|---|---| | 5000 | Inside the boxes | Both stores — moto-a and moto-b both listen on 5000 inside their own boxes | In every command in this lab. The commands run inside the awscli box, so they talk to the stores box-to-box, on 5000. The full address names the store: http://moto-a:5000 for the first store, http://moto-b:5000 for the second. | | 9000 | On your own machine | The first store, moto-a | When a program on your own machine — not inside a box — talks to the first store. No command in this lab uses 9000, because every lab command runs inside a box. | | 9010 | On your own machine | The second store, moto-b | Same, for the second store: a program on your own machine reaches moto-b on 9010. No command in this lab uses 9010 either. |
In short: 5000 is the door inside the boxes, and it is the only door the lab commands use. 9000 and 9010 are the doors on your own machine — one per store — for anything outside the boxes. If a command uses 5000, it is running inside a box. If you ever open a store from your own machine, use 9000 for the first store and 9010 for the second.
- Mirror — a copy that follows the original. When a new file lands in the first store, the mirror copies it to the second store.
- Terminal — the black window where you type commands. Every command in this lesson is typed in the terminal, then you press Enter.
- Folder / directory — the same thing. A folder holds files. This lesson says "folder" every time.
What you need first
- Docker running on your machine. The lesson points to Phase 2, zero-cost-lab.md, for setting Docker up. Do that first if Docker is not installed yet.
- How to tell Docker is running: open your terminal and type
docker ps, then press Enter.dockeris the tool.psmeans "show the boxes that are running". If Docker is running, you see a list — even an empty list — with no error. If you see an error about the daemon, Docker is not running yet. A daemon is just a background program — here, the Docker program itself running behind the scenes. - The files in the folder
phase1/object-store-lab. That folder holdsdocker-compose.yml,Dockerfile,mirror.sh, and a folder calledfiles/with two fake receipts:files/receipt-001.txtandfiles/receipt-002.txt. All four paths were checked to exist on disk.
Getting into the right folder
Every command in this lab is run from inside the folder phase1/object-store-lab.
- What:
cdmeans "change folder". It moves your terminal into a folder. - Why: the commands below look for
docker-compose.ymlin the folder your terminal is sitting in. If you are in the wrong folder, they fail. - How: open your terminal in the folder
phase1/object-store-labon your machine. If your terminal opens somewhere else, type this command, then press Enter:
`` cd phase1/object-store-lab ``
Type it exactly as shown, from the folder that holds phase1. cd means "change folder" — it moves your terminal into the folder named after it.
- Check you are in the right place: type
lsand press Enter.lsmeans "list the files here". You should seedocker-compose.yml,Dockerfile,mirror.sh, andfilesin the list. If you do not see them, you are in the wrong folder. Move again untillsshows them.
Step 1 — Start both stores
What this step does: it builds a small image and starts all four boxes: the two stores, the mirror, and the helper box that holds the file commands.
Why: nothing else works until the stores are running. The bucket, the uploads, and the mirror all need live stores.
The command, word by word, before you run it:
docker compose up -d --builddocker— the tool that runs boxes.compose— read the recipe filedocker-compose.ymland run everything it lists.up— start everything in the recipe.-d— run in the background. Short for "detached". It means: start the boxes and give me my terminal back, so I can type the next command. Without-d, the boxes would hold your terminal and you could not type anything else.--build— build the smallawsimage first, from theDockerfile, before starting. Needed on the first run. On later runs it just reuses the image.
Run it now, from inside the folder phase1/object-store-lab.
What you should see: first, build lines for the small aws image. The first start builds it, so it takes a couple of minutes. Then the boxes start, one line each. Wait until the lines stop.
How to tell it worked: run the check command below.
The check command, word by word:
docker compose psdocker compose— the tool, reading the recipe file.ps— show the boxes from this recipe and their state.
What you should see: a table with four names, each with STATUS "Up". "Up" means the box is running.
NAME STATUS
moto-a Up
moto-b Up
mirror Up
awscli UpThe real table has more columns than this. What matters is all four names, each with STATUS "Up".
moto-ais the first store.moto-bis the second store.mirroris the box that copies files from the first store to the second.awscliis a helper box. It holds theawsfile commands. It does nothing on its own — it just sits there, awake, so you can run commands inside it. That is why it was started with the order "sleep forever".
If it breaks: if docker compose ps shows a box as "Exited", that box stopped. "Exited" means it ran and then stopped, usually because of an error. Read its log with the command below. A log is the box's diary — lines it printed while it ran.
docker compose logs <name>docker compose logs— show the diary lines for one box.<name>— replace this with the real box name, for examplemirror. So the real command isdocker compose logs mirror. Look for the error line — it usually says what went wrong in plain words.
One more check — does the first store answer? The mirror waits for both stores, so give it a minute first. Then run:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 lsWord by word:
docker compose exec— run a command inside one box from this recipe.execmeans "run this inside the box".awscli— the box to run inside. We use this box because it holds theawstool.aws— the file-command tool for S3 stores.--endpoint-url http://moto-a:5000— talk to this store.http://moto-a:5000is the first store's address inside the boxes.moto-ais the store's name,5000is its door number.s3— use the S3 file commands.ls— list. With no bucket name after it, it lists all buckets.
What you should see: nothing, and no error. An empty answer with no error means the store is up and there are no buckets yet. That is correct at this point — you have not made the bucket yet.
Step 2 — Make the bucket (once)
What this step does: it makes the bucket called incoming in the first store.
Why: files live inside buckets. You cannot put a file into a store that has no bucket. The bucket is made once. If you run this step twice, the store says it already exists — that is fine, skip the step.
The command, word by word:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 mb s3://incomingdocker compose exec awscli— run a command inside theawsclibox. Same as Step 1.aws --endpoint-url http://moto-a:5000— the file tool, talking to the first store.s3— use the S3 file commands.mb— make bucket. Short for "make bucket".s3://incoming— the bucket to make.s3://means "a bucket in an S3 store".incomingis the bucket's name.
What you should see:
make_bucket: incomingThat one line means the bucket now exists. make_bucket is the tool's way of saying "bucket made".
If it breaks: if you see "BucketAlreadyExists", it means you already made the bucket — skip this step, nothing is wrong. Note: the mirror box also makes this bucket on both stores by itself when it starts (that is written in the file mirror.sh), so seeing "already exists" is normal. If the command fails another way, the store is not up yet — wait a minute and try again.
Step 3 — Put a fake file in
What this step does: it copies the first fake receipt into the bucket in the first store.
Why: this is the file the mirror will copy. No file in, nothing to mirror.
The command, word by word:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 cp /files/receipt-001.txt s3://incoming/docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3— same as Step 2: run the file tool inside theawsclibox, talking to the first store.cp— copy./files/receipt-001.txt— the file to copy. This path is INSIDE theawsclibox, not on your machine. The folderfiles/on your machine is shared into the box under the name/files, so/files/receipt-001.txtis the same file asfiles/receipt-001.txtin the folderphase1/object-store-lab. That sharing is written in the recipe filedocker-compose.yml.s3://incoming/— where to put it: inside the bucket calledincoming. The/at the end means "inside this bucket".
What you should see:
upload: /files/receipt-001.txt to s3://incoming/receipt-001.txtThat line means the file went up into the bucket. upload means "sent up into the store".
If it breaks: "NoSuchBucket" means the bucket was never made — go back to Step 2 and make it. "No such file" means the receipt file is missing — check the files/ folder in phase1/object-store-lab holds receipt-001.txt. Run ls files to see what is in it.
Prove it is there — list the bucket:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 ls s3://incoming/s3 ls s3://incoming/— list the files inside the bucket calledincoming. The rest of the command is the same as before.
What you should see: one line, like this:
2026-11-20 00:00:00 126 receipt-001.txtLine by line — it has four parts:
2026-11-20 00:00:00— the date and time the file was put in. Your date and time will match when YOU ran it, not the line above.126— the file's size in bytes. A byte is the smallest unit of file size.126just means the receipt file is 126 bytes long. Your number should be126too, because it is the same file.receipt-001.txt— the file's name.
If it breaks: if the list is empty, the upload in the step above did not happen — run the cp command again and check it prints the upload: line.
Step 4 — Watch it appear in the second store
What this step does: it lists the bucket in the SECOND store, to prove the mirror copied the file by itself.
Why: this is the payoff of the whole lab. You put the file in the first store once. The mirror — the box running the script in mirror.sh — checks every 10 seconds and copies new files to the second store. You did not copy it twice. The 10 seconds comes from the file mirror.sh: it ends with a loop that copies, then waits 10 seconds, then copies again.
Wait 30 seconds first. The mirror checks every 10 seconds, so 30 seconds gives it three chances.
The command, word by word:
docker compose exec awscli aws --endpoint-url http://moto-b:5000 s3 ls s3://incoming/This is the same list command as Step 3, except the address is now http://moto-b:5000 — the SECOND store, moto-b, instead of the first store, moto-a. Everything else is the same.
What you should see: receipt-001.txt there too:
2026-11-20 00:00:00 126 receipt-001.txtSame four parts as before: date and time (yours will differ), size 126, file name. The copy happened by itself — you did not copy it twice.
If it breaks: if the file is missing, wait another minute and list again — the mirror checks every 10 seconds. If it is still missing, check the mirror's diary:
docker compose logs mirrorLook for the word "ERROR" in the lines. "ERROR" means something failed, and the words after it usually say what. The most common cause is that the mirror started before the stores were ready. Fix it by restarting the mirror:
docker compose restart mirrordocker compose restart— stop one box and start it again.mirror— the box to restart.
Then wait a minute and list the second store again.
Step 5 — Add a second file and watch it follow
What this step does: it puts the second fake receipt into the first store, then checks the second store again.
Why: one copy could be luck. Two files following by themselves proves the mirror keeps working, not just once.
The command, word by word:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 cp /files/receipt-002.txt s3://incoming/Same copy command as Step 3, but the file is now receipt-002.txt — the second fake receipt. It goes into the FIRST store (moto-a).
What you should see:
upload: /files/receipt-002.txt to s3://incoming/receipt-002.txtIf it breaks: "NoSuchBucket" means the bucket was never made — go back to Step 2. "No such file" means the receipt file is missing — check the files/ folder in phase1/object-store-lab holds receipt-002.txt.
Wait 30 seconds, then list the SECOND store:
docker compose exec awscli aws --endpoint-url http://moto-b:5000 s3 ls s3://incoming/What you should see: both files now:
2026-11-20 00:00:00 126 receipt-001.txt
2026-11-20 00:00:00 120 receipt-002.txtTwo lines, one per file. The dates and times will match when you ran it, not the lines above. The sizes are different because the two files are different lengths: receipt-001.txt is 126 bytes and receipt-002.txt is 120 bytes. New files follow by themselves.
Step 6 — Download a file back
What this step does: it downloads the first receipt from the SECOND store and prints it on your screen.
Why: a name in a list could be an empty shell. Downloading the file and reading its words proves the file in the second store is a real copy, not just a name in a list.
The command, word by word:
docker compose exec awscli aws --endpoint-url http://moto-b:5000 s3 cp s3://incoming/receipt-001.txt -docker compose exec awscli aws --endpoint-url http://moto-b:5000 s3 cp— run the copy tool inside theawsclibox, talking to the SECOND store.s3://incoming/receipt-001.txt— the file to copy:receipt-001.txtinside the bucketincomingin the second store.-— a single dash. It means "print the file on the screen instead of saving it to a file". Without the dash, the tool would need a place to save the file. With the dash, the file's words appear in your terminal.
What you should see: the fake receipt text:
Fake receipt for practice only. Not a real document.
Order: order-101
Item: notebook
Amount: 250
Buyer: Asha
Date: 2026-11-20Line by line: a warning that the receipt is fake, then the order number order-101, the item notebook, the amount 250, the buyer Asha, and the date. This is the same text as the file files/receipt-001.txt in the folder phase1/object-store-lab. If the words match, the copy is real.
If it breaks: "NoSuchKey" means the file is not in the second store yet. "Key" is the S3 word for a file's name inside a bucket. Wait a minute — the mirror copies every 10 seconds — and try again.
Save your proof
The proof for this lab is the same file listed in both stores. Save both listings into one file with these commands, run from inside the folder phase1/object-store-lab.
First command — make the proof folder, word by word:
mkdir -p ../portfolio/proofmkdir— make a folder. Short for "make directory".-p— make the parent folders too if they are missing, and do not complain if the folder already exists.../portfolio/proof— the folder to make...means "go up one folder" — fromphase1/object-store-labup tophase1. Thenportfolio/proofis the folder insidephase1/portfolio. The full path isphase1/portfolio/proof, and it holds the proof files. That folder was checked to exist on disk.
Second command — save the first store's list:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 ls s3://incoming/ > ../portfolio/proof/object-store-mirror.txtThis is the Step 3 list command, with one extra piece at the end:
>— send the output into a file instead of onto the screen. It overwrites the file if the file already exists.../portfolio/proof/object-store-mirror.txt— the file to write into.object-store-mirror.txtis a plain text file.
Third command — add the second store's list to the same file:
docker compose exec awscli aws --endpoint-url http://moto-b:5000 s3 ls s3://incoming/ >> ../portfolio/proof/object-store-mirror.txt>>— send the output into the same file, but ADD it at the end instead of overwriting. Two>signs mean "append". One>sign means "overwrite". That is the only difference between the second and third commands.
What you should see: nothing in the terminal when you run the save commands. That is correct — the listings went into the file, not the screen. Silence means it worked here.
Check the file: open phase1/portfolio/proof/object-store-mirror.txt and check both receipt-001.txt and receipt-002.txt appear twice — once per store. That file is your proof.
If it breaks: if the file lists each receipt only once, the mirror had not copied yet when you saved — wait a minute, then run the save commands again.
Clean up
What this step does: it stops all four boxes and removes them.
Why: the lab is done. The boxes would otherwise keep running and using your machine. The files live only in memory, so stopping the lab wipes them. That is fine — the files were fake. Run the steps again any time you want to practise.
The command, word by word:
docker compose downdocker compose— the tool, reading the recipe file.down— stop all the boxes in the recipe and remove them. Different fromstop, which stops them but keeps them around.downclears them away.
Run it from inside the folder phase1/object-store-lab.
What you should see:
✔ Container moto-a Removed
✔ Container moto-b Removed
✔ Container mirror Removed
✔ Container awscli RemovedFour lines, one per box. ✔ is a tick mark. Removed means the box is gone. If you see all four, the clean-up worked.
What you can now say, truthfully
"I ran two Moto object stores (a free S3 stand-in), made a bucket, uploaded files with the aws tool, and set up a mirror that copies new files to the second store by itself."
What this lab does NOT cover
- Real stores use access keys per app, not one shared login. An access key is like a separate password for each app, so one app cannot use another app's key. This lab uses one shared login on purpose — the name
learnerand the password are written in the recipe filedocker-compose.yml— so you can learn. Do not copy that habit into real work. - The mirror here copies one way only, from the first store to the second. Two-way sync, where each side copies to the other, is a different setup.
- Large files, versioning (keeping old copies of a file when it changes) and lifecycle rules (rules that delete old files by themselves) are later topics. The ideas are the same; the setup is bigger.
- The Advanced section at the end of this lesson now covers versioning, lifecycle rules, multipart uploads, presigned URLs, and what the mirror script and Moto cannot do.
Advanced — Versioning, lifecycle, multipart, presigned URLs, and the mirror's limits
This section is for the reader who already did the lab above. It covers the four things the review of this kit flagged as missing for advanced readers: versioning, lifecycle rules, multipart uploads, and presigned URLs — plus an honest list of what the polling mirror script and the in-memory stand-in cannot do, and the shared-login risk. The commands use the lab's own idiom (docker compose exec awscli aws --endpoint-url http://moto-a:5000 ...). Moto is a stand-in: it answers most S3 calls, but if it answers with an error saying a feature is not supported, that is a Moto limit, not your mistake. Real S3 supports all of these.
Advanced 1 — Versioning: keep the old copies
What this is: versioning means the store keeps every version of a file. When you upload a file with the same name again, the old copy is not deleted — it is kept beside the new one. When you delete a file, the store only leaves a marker saying "deleted"; the old versions are still there underneath. Why it matters: it is the undo button for overwrites and deletes. Without it, one wrong upload destroys the only copy.
Turn it on for the lab's bucket:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3api put-bucket-versioning --bucket incoming --versioning-configuration Status=EnabledWord by word: s3api is the low-level S3 tool — it takes exact settings, where plain s3 takes simple file commands. put-bucket-versioning sets the versioning rule for a bucket. Status=Enabled turns it on. Check it:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3api get-bucket-versioning --bucket incomingWhat you should see: Status followed by Enabled. Now prove it keeps old copies. Make a small file inside the awscli container, upload it twice with different words, and list the versions:
docker compose exec awscli sh -c "printf 'version one\n' > /tmp/note.txt"
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 cp /tmp/note.txt s3://incoming/note.txt
docker compose exec awscli sh -c "printf 'version two\n' > /tmp/note.txt"
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 cp /tmp/note.txt s3://incoming/note.txt
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3api list-object-versions --bucket incoming --prefix note.txtWhat you should see: two versions of note.txt listed, each with its own version ID. The plain s3 cp download still gives you the newest one; the old one is reached by its version ID. Two warnings: versioning only starts from the moment you turn it on — files uploaded before that have no old versions to recover. And versioning keeps everything, so a bucket that changes often grows forever unless lifecycle rules (next) clean it up. Real S3 replication also needs versioning on, because it copies versions, not just files.
Advanced 2 — Lifecycle: rules that clean up by themselves
What this is: a lifecycle rule is a rule the store follows by itself: delete old files after some days, delete old versions, or move files to cheaper storage. Why it matters: without rules, a versioned bucket grows forever and the bill grows with it. With rules, cleanup happens even when nobody remembers.
Save this rule as /tmp/lifecycle.json inside the awscli container, using the heredoc file-making way from the zero-cost lab:
docker compose exec awscli sh -c 'cat > /tmp/lifecycle.json << "EOF"
{
"Rules": [
{
"ID": "expire-old-versions",
"Status": "Enabled",
"Filter": { "Prefix": "" },
"NoncurrentVersionExpiration": { "NoncurrentDays": 30 }
}
]
}
EOF'Word by word: the JSON says one rule, named expire-old-versions, turned on, applying to every file (Prefix empty means all files). NoncurrentVersionExpiration with NoncurrentDays: 30 means "delete a version 30 days after a newer version replaced it". The current version is never touched by this rule — only old ones. Apply it:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3api put-bucket-lifecycle-configuration --bucket incoming --lifecycle-configuration file:///tmp/lifecycle.jsonCheck it:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3api get-bucket-lifecycle-configuration --bucket incomingWhat you should see: the rule back, as you wrote it. Two more rule shapes to know by name: Expiration (delete the current version after N days — for files that are only useful for a while, like daily exports) and Transitions (move files to cheaper storage after N days — for files you rarely read). If Moto answers with an error on the put command, that is a Moto limit: real S3 accepts this rule.
Advanced 3 — Multipart: big files, sent in pieces
What this is: a multipart upload splits a big file into parts and uploads each part separately, then joins them. Why it matters: if one part fails, you re-send only that part, not the whole file. And parts can upload at the same time, so big files go faster.
The practical fact first: you rarely do this by hand. The plain aws s3 cp command already splits big files into parts by itself (files above 8 MB by default). So s3 cp on a 500 MB file is already a multipart upload — you just do not see the pieces. The by-hand flow exists for when you need control: pausing, resuming, or uploading from a program. It has three steps, and the first command is real — run it and read its output:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3api create-multipart-upload --bucket incoming --key big-file.binWhat you should see: a line with an UploadId — a long code that names this upload. Keep it: step two uploads each part with upload-part, giving the UploadId, a part number, and the part file, and each part answers with an ETag (a fingerprint of that part). Step three finishes with complete-multipart-upload, giving the list of part numbers and their ETags. If you stop halfway, the unfinished parts sit in the store until a lifecycle rule cleans them up (AbortIncompleteMultipartUpload is the rule name) — that is a real bill in real work: unfinished uploads are charged as stored data.
Advanced 4 — Presigned URLs: a link that works without the login
What this is: a presigned URL is a web link to one file that works for a set time, without the login. The link itself carries a signature (a stamp that proves it was made by someone with the login) and an expiry time. Why it matters: it lets you share one file with one person — "download your receipt here, this link works for one hour" — without giving them your login or making the file public.
Make one for the lab's receipt file:
docker compose exec awscli aws --endpoint-url http://moto-a:5000 s3 presign s3://incoming/receipt-001.txt --expires-in 3600Word by word: s3 presign makes the link. --expires-in 3600 means it works for 3600 seconds — one hour. What you should see: a long link printed. Two facts that matter: making the link needs no call to the store — it is computed on your machine from your login — so it works even while the store is busy. And anyone with the link can read the file until it expires, so treat the link like a password: send it to one person, not to a public page. After the hour, the same link answers with an error, and the file itself is untouched.
Advanced 5 — What the mirror script and Moto cannot do
Read the lab's own mirror.sh before you trust the mirror. It is a loop: download new files from store a to a local folder, upload that folder to store b, sleep 10 seconds, repeat. That design has four honest limits:
- Up to 10 seconds behind, always. A file written to a is not on b until the next loop runs. The Kafka lab's Step 6 already shows this shape; the same is true here. Real S3 replication is event-driven — a new file starts copying at once, not on a timer.
- Deletes do not copy. The script runs
aws s3 syncwithout--delete, so a file deleted on a stays on b forever. A mirror that never deletes is not a mirror — it is a growing pile. - Whole files only. The script copies whole files, not changes. A file changed halfway through a copy can arrive half-old. Real replication copies versions, which is why it needs versioning on (Advanced 1).
- One way only, and it fights two-way. If you ran the same script in both directions, each side would overwrite the other's newest file. Two-way sync is a different, harder setup. And Moto keeps everything in memory: stop the lab and the files are gone — the "does NOT cover" section above already says so, and it applies to versions and lifecycle rules too. A version you proved in Moto is proof of the idea, not a stored file.
Advanced 6 — The shared login is a real-world risk
What this is: the lab uses one login — the name learner and the password — for every app, written in the compose file. The lab's own "does NOT cover" section says this is on purpose for learning and tells you not to copy the habit. Here is why, in plain words: one login for every app means one leaked login opens every app. If the app that sends receipts is hacked, the attacker also gets the app that deletes files — because they share the key. Real work gives each app its own access key, each key only the permissions that app needs (one app may read, another may write, neither may delete the other's files), and rotates keys — replaces them regularly, so a leaked key stops working soon. Secrets live in a secrets store, never in a file that goes to a shared repository. The password in this lab's compose file is a practice password on your own machine; the habit to build is "one key per app, least permission, never in the repo".
What you can now say, truthfully — advanced
- "I turned on S3 versioning, uploaded two versions of a file, and listed both by version ID." (Only if you did Advanced 1.)
- "I wrote a lifecycle rule that deletes old versions after 30 days, and applied it with
put-bucket-lifecycle-configuration." (Only if you did Advanced 2.) - "I can explain multipart uploads, and that plain
aws s3 cpalready splits big files by itself." (Only if you did Advanced 3.) - "I made a presigned URL for one file, valid for one hour, and know anyone with the link can read it until it expires." (Only if you did Advanced 4.)
- "I know the lab's mirror is a 10-second polling script that does not copy deletes, and that Moto forgets everything on stop." (Only if you did Advanced 5.)
Quick check — try it yourself
Question: How do you store and get back a file in an object store?
Open the practice terminal to test this →
Show answer
An object store works like a big file cupboard where you save a file by a name and ask for it back using that same name.