Technical
DynamoDB Streams: The Quiet Superpower in My Stack
DynamoDB is famous for its key-value speed. The feature that earned its place in my stack, though, is less celebrated: Streams. By turning every write into an event, Streams let me build event-driven systems without a dedicated event bus. Months in, this is the piece I'd miss most.
What Streams Give You
Enable Streams on a table and every insert, modify, or delete produces an event. A Lambda can consume the stream, process each event, and trigger side effects: send an email, update a cache, write to a secondary table. The producer doesn't know the consumers exist.
The Pattern I Use Most
My go-to use case: write once, react many times. A new subscriber row appears in DynamoDB. The stream Lambda fires welcome email, updates the dashboard cache, and logs to analytics. Three side effects, zero coupling in the write path.
def handler(event, context):
for record in event['Records']:
if record['eventName'] != 'INSERT':
continue
item = deserialize(record['dynamodb']['NewImage'])
send_welcome_email(item['email'])
invalidate_cache(item['id'])
log_event('subscribe', item)Why I Ignored It
I ignored Streams for months because the docs lead with change-data-capture for analytics. That's a real use case, but a boring one. The exciting use case is decoupling side effects from business writes. Once I saw that, Streams went from 'maybe someday' to 'default on for every new table.'
See the DynamoDB Streams docs.
RELATED READING
The Consulting Shift I Am Making In Year Two
After a year of writing and building, my consulting practice is changing shape. Shorter engagements. Sharper outcomes.
ReadThe Frontend Shift: Shipping Less JavaScript In Year Two
A year ago I reached for Next.js for everything. This year I often reach for nothing.
ReadThe Serverless Lesson I Would Write On A Sticky Note
After a year of shipping serverless projects, one rule explains most of the wins and all of the losses.
Read