TwiceToldby Develoker
ConceptsSystem designLabsCheat sheetsAbout

Develoker makes free tools for learning to build software. TwiceTold explains each idea twice, as an everyday analogy and the real thing; CloudArch lets you design cloud systems and put load on them.

About ยท Labs ยท Cheat sheets ยท Learning paths

โ† Back to Amazon S3

๐Ÿชฃ 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.
Buckets, objects and keysStep 4 of 4
๐Ÿšช Room photos-ana๐Ÿ™‹Ana๐Ÿ“ฆ Box 2024/cat.jpg๐Ÿ“ฆ Box 2024/dog.jpg๐Ÿ“ฆ Box notes.txt
  1. 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.
  2. Two more boxes go in. The labels look like they sit in a cupboard called 2024, but each label is just one long name.
  3. Ana asks for every box whose label starts with 2024/. The clerk finds the two that match, by the start of their label.
  4. To get the cat photo back, Ana just says its label, and the whole box comes back to her.
Whole objects, read right awayStep 4 of 4
๐Ÿšช Room docs-ana๐Ÿ™‹Ana๐Ÿ™‹โ€โ™‚๏ธBen๐Ÿ“ฆ Box report.pdfv3b (last wins)๐Ÿง‘Cara
  1. 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.
  2. The new box takes the old one's place, and the desk tells Ana "stored".
  3. Straight after, Cara asks for report.pdf and gets the new box. Once the desk says "stored", everyone gets the new one.
  4. 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.
Durability versus availabilityStep 5 of 5
๐Ÿ—๏ธ The warehouse๐Ÿ™‹Ana๐Ÿข Building A๐Ÿฌ Building Bcopy๐Ÿญ Building Ccopy
  1. Ana hands in a box. The warehouse copies it into all three of its buildings, in different parts of town.
  2. Only once the copies are safe does the desk tell Ana "stored".
  3. Building A floods! Ana's box is still safe in the other two buildings.
  4. Ana asks for her box, and it comes from Building B as if nothing had happened.
  5. 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.
Versions and lifecycle rulesStep 5 of 5
Shelf for report.pdfv1key version 1: v10v2key version 2: v21DELkey delete marker: DEL23current๐Ÿ™‹Ana๐Ÿ—„๏ธ Back room๐Ÿ”๏ธ Deep vaultv1, v2
  1. With "keep old boxes" switched on, Ana hands in her report. It goes at the front of its shelf.
  2. She hands in a new report. The old box isn't thrown away; it just moves behind the new one.
  3. 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.
  4. 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.
  5. After six months they go down to the deep vault, which is very cheap but takes hours to fetch from.
Who may open the roomStep 5 of 5
๐Ÿ•ต๏ธStranger๐Ÿง‘โ€๐Ÿ’ผAna's helper๐Ÿง‘Ana's friendexpired๐Ÿšช Room invoices-shoppublic blocked๐Ÿ“œ Rule sheet
  1. 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.
  2. Ana's helper asks for a box. The clerk checks the rule sheet, which says the helper may fetch boxes, and hands it over.
  3. 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.
  4. 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.
  5. An hour later the friend tries the same pass again. It has run out, so the clerk says no.
Multipart uploadStep 4 of 4
Crates waitingp1key part 1, ETag a1: p10p3key part 3, ETag c3: p31p2key part 2, ETag b2: p223๐Ÿ™‹Ana๐Ÿ“ฆ Box movie.mp4
  1. 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.
  2. Helpers carry crates 1 and 3 at the same time. Crate 2 is dropped on the way.
  3. Only crate 2 is carried again, not the whole film. The crates don't need to arrive in order.
  4. 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.