Before we touch a single line of code, we need to reset our mental model.
If you've spent your career writing Ruby on Rails applications, you're used to a certain kind of architecture:
You deploy it all, maybe with Capistrano or Docker, or maybe just from your terminal with a quick Heroku command. And it hums along as long as the servers are happy.
That works fine, until it doesn't.
The word serverless is a little misleading. There are still servers. You're just not the one managing them.
Serverless = "event-driven, auto-scaling, pay-per-use infrastructure managed by someone else."
In practice, this means:
This model is perfect for bursty workloads, one-off processing, or tasks that don't need a constantly running server.
It's not about replacing your app, it's about augmenting it.
At the center of all of this is AWS Lambda.
Lambda lets you:
The best part? No provisioning. No load balancing. No autoscaling groups. No idle EC2 costs. No servers to patch. No Sidekiq processes to monitor.
A Lambda function can spin up in milliseconds, execute, and disappear, without you ever logging into a box.
There's a lot of hype around serverless, so let's clear the air.
Serverless is not:
You're trading control for scalability and cost for flexibility. But when used correctly, it's an incredible superpower.
Here's where things get interesting.
Ruby isn't the first-class citizen in AWS docs like Node or Python, but when you Dockerize your Lambda, the playing field is level.
Using the container runtime:
Pair this with your existing Rails app, and suddenly you have a hybrid architecture:
Each does what it's best at.
Here are some clear signals that Lambda is a great fit:
If you're used to monoliths, here's the shift:
Monolith Thinking | Serverless Thinking |
---|---|
Long-lived app process | Short-lived function calls |
Always-on workers | Triggered by events |
One app = one repo | One function = one concern |
Horizontal scaling via EC2 | Infinite scaling via Lambda |
Cost = uptime | Cost = usage |
It's not about rewriting everything. It's about knowing when to offload.
In the next chapter, we'll break down the core AWS services that power this architecture.
You'll meet:
Don't worry, we'll keep it approachable and relevant to Ruby devs. No jargon, just the bits you need.