โ Back to AWS KMS and Secrets Manager
๐ฆ AWS KMS and Secrets Manager: cheat sheet
๐จ The analogyA bank vault whose master keys never leave: you lock your box, and the vault locks your small key.
๐ The regular explanationHow AWS keeps encryption keys and credentials safe. KMS keys live in hardware security modules and never leave them, data is protected by envelope encryption with data keys, and Secrets Manager stores credentials encrypted under KMS and rotates them on a schedule.
- Ana brings a small envelope with a card number to the vault window and asks the clerk to lock it with her master key.
- The clerk locks it inside the vault and passes back the locked envelope. The visit goes in the visitor book.
- Later Ana hands the locked envelope back. The clerk unlocks it inside and gives her the card number.
- Ana asks to take the master key home for a day. The clerk refuses. Master keys never leave the vault, for anyone.
- Ana's contracts are far too big for the vault window. So she asks the clerk for a fresh small key instead.
- The clerk hands over two things, the small key itself and a copy of it sealed in a tin only Ana's master key opens.
- At her shop, Ana locks the box with the small key and tapes the sealed tin to it. Nothing big ever went to the vault.
- Then she throws the loose small key away. A thief who finds the box finds only a locked box and a sealed tin.
- To read the contracts, Ana takes just the tin to the vault. The clerk unseals it and gives back the small key, and she opens the box herself.
- Ana's shop asks to unseal a tin. The clerk reads the card on the key's hook first. It names Ana's shop, so the answer is yes.
- Leo's company list says he may use any key. But this key's card doesn't name him and doesn't let company lists count, so the clerk says no.
- Ana wants the storage room clerk to open tins for her boxes. She hands the vault clerk a slip saying so, instead of rewriting the card.
- The storage room clerk shows up with a tin, the vault clerk checks the slip, and hands back the small key.
- Every visit, allowed or refused, is in the visitor book. Ana can see exactly who used her key and when.
- The shop needs the stockroom password, so it asks the password drawer for "stockroom" by name.
- The password is sealed in the drawer, so the drawer has the vault clerk unseal it.
- The drawer reads the password out to the shop, which jots it on a card in its pocket for the next hour.
- The shop opens the stockroom door with the password from its pocket card, without walking back to the drawer.
- The drawer holds the stockroom password, marked current. The shop reads it whenever it needs to.
- The timetable says it's time. The caretaker makes up a new password and puts it in the drawer, marked pending.
- The caretaker goes to the stockroom door and changes its lock to the new password.
- The caretaker tries the new password on the door, to be sure it really works.
- Now the caretaker moves the current tag to the new password and marks the old one previous, just in case.
- Next time the shop asks, it gets the new password. Nobody had to tell the shop anything.
- At opening time, before serving anyone, the shop collects the stockroom password from the drawer.
- It also picks up a small setting from its mailbox by the counter. Mailboxes are sealed too, but nobody changes them on a timetable.
- Now the shop opens, and opens the stockroom door with the password it collected.
- After the caretaker changes the password, the shop's morning copy no longer works at the door.
- So the shop goes back to the drawer for the new password and tries again, and the door opens.
๐งฉ Key questions
- A thief breaks into Ana's shop and steals a locked box with its sealed tin taped on. What can the thief read?
- Nothing, unless the vault clerk agrees to unseal the tin for them. The tin is sealed with a master key that never leaves the vault, and the clerk checks who's asking and writes it in the visitor book.
- Why doesn't Ana just hand all her contracts to the vault clerk to lock, page by page?
- The vault window only takes small envelopes, and only a tiny tin needs to travel this way. Ana locks the big box herself and only the small key's tin goes to the vault.
- Leo's company list says he may use any vault key. The card on Ana's key names only Ana and doesn't let company lists count. What happens when Leo asks?
- The clerk says no, because the key's own card has the last word. A company list only counts for a key whose card says company lists may count.
- The caretaker has put a new password in the drawer and changed the lock, but the test try fails. What does the shop get when it asks for the password?
- The old password, still marked current, and someone should look at the door. The current tag only moves at the last step, so readers never get an untested password. But the lock was already changed, so the failure must be fixed.
- Ana keeps some secrets in a counter mailbox instead of the password drawer. Which secret belongs in the drawer?
- The stockroom password, which should change on a timetable. Both are sealed with vault keys, but only the drawer has a caretaker who changes passwords.