๐ชฃ Amazon S3: cheat sheet
๐จ The analogyA huge storage warehouse: hand in labelled boxes, get them back by label, with copies kept in three buildings.
๐ The regular explanationAWS's object storage service. Buckets hold objects addressed by flat keys over an HTTP API, with eleven nines of designed durability, strong read-after-write consistency, versioning, storage classes and policy-based access control.
- Ana seals her cat photo in a box, writes the label 2024/cat.jpg on it and hands it in. It goes into her room, photos-ana.
- Two more boxes go in. The labels look like they sit in a cupboard called 2024, but each label is just one long name.
- Ana asks for every box whose label starts with 2024/. The clerk finds the two that match, by the start of their label.
- To get the cat photo back, Ana just says its label, and the whole box comes back to her.
- The box report.pdf holds Ana's first report. She can't open it on the shelf to fix a page, so she hands in a whole new box with the same label.
- The new box takes the old one's place, and the desk tells Ana "stored".
- Straight after, Cara asks for report.pdf and gets the new box. Once the desk says "stored", everyone gets the new one.
- Ana and Ben hand in a box with the same label at the same moment. Nobody waits in line, and the one that arrives last is the one that stays.
- Ana hands in a box. The warehouse copies it into all three of its buildings, in different parts of town.
- Only once the copies are safe does the desk tell Ana "stored".
- Building A floods! Ana's box is still safe in the other two buildings.
- Ana asks for her box, and it comes from Building B as if nothing had happened.
- Once in a while the desk is swamped and says "come back in a moment". The box was never in danger; Ana just asks again and gets it.
- With "keep old boxes" switched on, Ana hands in her report. It goes at the front of its shelf.
- She hands in a new report. The old box isn't thrown away; it just moves behind the new one.
- Someone says "throw it out". The clerk only sticks a "removed" card in front. Asking for report.pdf now gets "not here", but both boxes are still behind the card.
- The note for the clerks says that after 30 days old boxes go to the back room, where rent is cheaper but fetching costs a little.
- After six months they go down to the deep vault, which is very cheap but takes hours to fetch from.
- A stranger walks up and asks for a box. The room is locked and its sign says "no strangers, ever", so the clerk says no.
- Ana's helper asks for a box. The clerk checks the rule sheet, which says the helper may fetch boxes, and hands it over.
- Ana's friend needs one box. Instead of a key, Ana's helper writes a visitor pass for that one box and signs it, good for 15 minutes.
- The friend shows the pass at the desk and the clerk checks the helper's signature. The friend gets the box without ever being on the rule sheet.
- An hour later the friend tries the same pass again. It has run out, so the clerk says no.
- Ana's film is far too big for one trip. She tells the desk she'll send it in crates, and gets a ticket number for the job.
- Helpers carry crates 1 and 3 at the same time. Crate 2 is dropped on the way.
- Only crate 2 is carried again, not the whole film. The crates don't need to arrive in order.
- Ana tells the desk "that's all, crates 1, 2 and 3". The clerks join them into one box, and only now does it appear on the shelf.
๐งฉ Key questions
- Ana wants every label that starts with 2024/ to start with old/2024/ instead. What has to happen?
- Hand in every box again under its new label and throw out the old ones. There are no cupboards, only long labels, so every box has to get a new label one by one.
- A building floods and the desk is briefly swamped and says 'come back in a moment'. Is Ana's box lost?
- No: copies are in other buildings, and a busy desk only means asking again. Keeping boxes safe and being open right now are two separate promises.
- Versioning is on and someone throws out report.pdf by mistake. Can Ana get it back?
- Yes: take the 'removed' card away and the newest box is back in front. Throwing out only adds a card; the old boxes stay behind it.
- Ana's helper gives a friend a 15-minute visitor pass. What can the friend do with it?
- Fetch that one box, until the 15 minutes are up. The pass names one box and runs out, so nobody needs a key.
- Ana's helper drops crate 2 of a huge upload and then never says 'that's all'. What happens?
- There's no box, and the crates sit there costing rent until they're cleared away. That's why a note for the clerks should say to clear away unfinished crates.