
Weekend Showcase Challenge: Vanish — One-Time Secret Links on AWS Lambda + DynamoDB
A one-time secret link service where the browser holds the encryption key and AWS only ever stores ciphertext it cannot read. Built on a single Lambda Function URL plus DynamoDB — and the two deploy failures that taught me more than the successes.
Every team has the same bad habit. Someone needs a database password or an API key, and it ends up pasted into Slack, where it sits forever in a search index, in a laptop backup, and in whatever retention policy nobody has read. The credential gets rotated eventually. The copy does not.
I spent the last weekend of the AWS Summer Build Series fixing that for myself. Vanish is a one-time secret link service: you paste a credential, you get a URL, you send the URL. The recipient opens it exactly once, and in the same operation that hands them the payload, the record is deleted from DynamoDB. Open the link again and you get a 404 — not because the app is pretending, but because there is nothing left to return.

The vision: make the server useless to steal
Plenty of tools do one-time links. What I wanted was a version where compromising my AWS account gets an attacker nothing, so I designed against my own infrastructure.
The browser generates an AES-256-GCM key with
crypto.subtle.generateKey() , encrypts the secret locally, and sends only the ciphertext to AWS. The key is appended to the share link after a # . That detail is the whole design: browsers never transmit the fragment to the server, so the key is not in my request logs, not in CloudWatch, and not in DynamoDB. My backend stores a blob it has no ability to read.Then I pushed it one step further in IAM. The Lambda execution role is granted exactly two DynamoDB actions:
PutItem and DeleteItem . It has no GetItem , no Query , no Scan . Even if I wrote a bug — or a backdoor — that tried to peek at a stored secret, the call would be denied. The security property is enforced by the policy document, not by my good behaviour.
How I built it
The whole thing is one CloudFormation template and about 200 lines of Python.
A single Lambda behind a Function URL serves both the HTML UI and the JSON API. There is no API Gateway, no CloudFront distribution, no S3 bucket for static assets — the UI is a single file read into memory at cold start and returned from the
/ route. For an app with two endpoints, adding API Gateway would have been ceremony, and Function URLs gave me HTTPS and a public hostname for free.DynamoDB holds one table:
id , ciphertext , expiresAt . Reads are the interesting part. Instead of get-then-delete, a burn is a single call:result = table.delete_item( Key={"id": secret_id}, ConditionExpression="attribute_exists(id)", ReturnValues="ALL_OLD",)That is atomic. If two people click the link at the same moment, exactly one delete succeeds and gets the payload; the other gets a
ConditionalCheckFailedException and a 404. There is no window between reading and deleting for a race — or a crash — to leak a second copy.Deployment is
./deploy.sh : CloudFormation for the infrastructure, then aws lambda update-function-code to ship src/ as a zip. Two minutes from clone to a live URL.Five things this summer actually taught me
DynamoDB TTL is a janitor, not a guarantee. I assumed an item with a past
expiresAt would be gone. AWS documents deletion as typically within 48 hours of expiry, so an "expired" secret is readable for up to two days if you trust the sweeper. The handler now compares the timestamp itself on every read and refuses the payload — it still burns the item on the way out. TTL is a cost optimisation that keeps my table small; it is not the expiry mechanism.Chat clients will open your links for you. Burning the secret on
GET is the obvious REST answer, and it is wrong here. Slack, WhatsApp and Teams all prefetch links to build a preview, so a GET that destroys data means the preview bot consumes the secret before the recipient ever clicks. Burning is POST only. Link preview crawlers are part of your threat model whether you invited them or not.Error messages leak. It is tempting to distinguish "no such secret" from "already opened", because it is friendlier. It also turns the 404 into an oracle: an attacker can probe random IDs and learn which ones were ever real. Both cases return identical text.
A brand-new AWS account is not a small version of an old one. A Function URL with
AuthType: NONE is open to the internet and to anyone curious about what your credit card does under load, so I set ReservedConcurrentExecutions: 5 as a seatbelt. My first deployment failed on it:Specified ReservedConcurrentExecutions for function decreases account'sUnreservedConcurrentExecution below its minimum value of [10]A fresh account gets a total concurrency quota of 10, not the 1,000 every tutorial assumes, and Lambda refuses any reservation that would leave fewer than 10 unreserved. Reserving any concurrency is therefore impossible on a new account until you request a quota increase. The template now takes the reservation as a parameter that defaults to off, with a comment explaining why — because the next person to clone it will hit exactly this wall, and a cryptic 400 from CloudFormation is a miserable way to learn about service quotas.
A green CloudFormation stack is not a working application. My stack reached
CREATE_COMPLETE with every resource healthy, and the live URL answered:{"Message":"Forbidden. For troubleshooting Function URL authorization issues, see: ..."}The function URL's auth type was
NONE and CloudFormation had created a resource policy granting lambda:InvokeFunctionUrl to principal * — which is what every example shows. It still returned 403 for every request. The Lambda console's own warning was more specific than the docs: it wanted lambda:InvokeFunction and lambda:InvokeFunctionUrl . Adding the second action made the page load instantly. Since AWS::Lambda::Permission takes one action per resource, the template now declares two, both with DependsOn the function URL.CREATE_COMPLETE means AWS built what you described. Whether what you described actually works is a separate question, and the only way to answer it is to open the URL.Testing it honestly
Claiming "the server never sees your secret" is easy; proving it is the work. The repo has 15 handler tests plus an end-to-end suite that drives the real UI in Chromium and asserts the things that would embarrass me if they were false: the stored blob contains neither the plaintext nor the key, a second open is refused, a tampered key fails to decrypt, and a link visited without its fragment warns the user instead of silently burning their secret.
Cost at demo volume is zero — Lambda's free tier, DynamoDB provisioned at 5 RCU/5 WCU inside the always-free allowance, and TTL deletions that AWS does not bill for.
Shout-out
Big thanks to @harshendra for The Serverless Illusion: How AWS Lambda Really Works at Scale. His argument is that "serverless" is not a no-management promise but a meticulously engineered distributed system, and that the abstraction hides real operational trade-offs rather than removing them.
I read it after two deploys failed on things no tutorial had mentioned — a concurrency quota I did not know my account had, and a resource policy that looked textbook-correct and still returned 403. His article named what I had walked into: the abstraction is thin, and the system underneath has its own limits, defaults and rules. That framing is why the two hardest paragraphs in this post are about failures instead of features.
Clone it, deploy it into your own account, and stop pasting keys into Slack.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article