Book a free call

How to Implement Serverless Without Rebuilding Your App

Serverless implementation starts with one small, stateless workload, not a full rewrite. Learn the steps, the cost controls and the mistakes to avoid.

Hertiv engineering teamReviewed by a senior engineer
6 min read
How to Implement Serverless Without Rebuilding Your App
On this page

Short answer

To implement serverless, pick one small stateless workload, package it as a function, connect it to managed triggers and data stores, then measure cost and latency before moving anything else. You keep your existing systems in place and move workloads one at a time, which limits risk and lets the team learn the new model on a real service.

What does implementing serverless mean?

Implementing serverless means running code on a cloud platform that provisions, scales and patches the servers for you, so your team ships functions instead of managing machines. You write a function, tell the platform when it should run, and the platform handles the rest.

You still own the code, the configuration and the data. What changes is the operating layer: there is no server to patch, no capacity to plan in advance and no idle machine to pay for when nothing runs. Billing follows actual use, usually per request and per unit of compute time.

Serverless is not the same as having no infrastructure. The platform runs your code on shared infrastructure and hides it from you. That trade-off is the point: less control over the machine, less work keeping it running. For background on the model itself, see what serverless is.

Which workloads should you move first?

The best first workload is small, stateless and easy to measure, because a small win teaches the team the model without risking a core system. Event-driven jobs such as file processing, webhooks and scheduled tasks are the usual starting point.

Workload Why it fits serverless Watch out for
Image or file processing Triggered by uploads, bursty by nature Large files and long runtimes
Webhooks and API glue Short runs, clear inputs and outputs Third-party rate limits
Scheduled jobs Run on a timer, no server needed between runs Jobs that run longer than the time limit
Chatbots and form handlers Spiky traffic, stateless requests Cold starts on the first request
Data pipelines Each record can trigger its own run Ordering and duplicate delivery

Avoid starting with a long-running, stateful or latency-sensitive core service. A checkout flow or a real-time game server needs careful design before it belongs in functions, and a bad first migration can turn the team against the model.

How do you move a workload to serverless?

You move a workload to serverless in small steps, starting with the trigger and the data it touches, then the function itself, then traffic. Each step can be tested on its own before the next one begins.

  1. Map the workload. Write down its trigger, inputs, outputs, data stores and failure modes. If you cannot list them, the workload is too big to move as one piece.
  2. Pick the platform service. Choose the function service and the managed trigger that fits: an HTTP gateway, a queue, a storage event or a timer. Keep the choice boring and well documented.
  3. Extract one function. Pull the workload out of the existing app as a single function with a clear input and output. Do not rewrite the business logic at the same time.
  4. Move state out of the function. Put shared state in a managed database, cache or object store, because functions are short-lived and cannot hold state between runs.
  5. Add logging and alerts. Log each run with a request id, and alert on errors and on runs that approach the time limit. Serverless failures are invisible without this.
  6. Shift a small share of traffic. Route a small share of real traffic to the function, compare results with the old path, then raise the share once the numbers match.

Keep the old path running until the new one has handled real traffic for at least a few weeks. A rollback is then a routing change, not a redeploy.

What does serverless cost and how do you keep it in check?

Serverless cost comes from requests, compute time and the managed services your functions call, so the bill follows traffic closely. That makes small workloads cheap and makes runaway workloads expensive in a hurry.

Cost part What drives it How to control it
Requests Number of invocations Batch events instead of one call per record
Compute time Duration and memory size Set memory to the smallest size that fits
Data transfer Traffic leaving the cloud region Keep functions near the data they read
Managed services Queues, databases, API gateways Remove unused triggers and test resources

Set a monthly budget alert before the first production run, and review the bill weekly for the first month. The most common surprise is a retry loop: a failing function that retries thousands of times and bills for every attempt. For pricing detail, check the vendor's own pricing page, or see cloud services for help with cost design.

How do you handle state, cold starts and timeouts?

You handle state, cold starts and timeouts by designing for them up front, because each one is a property of the model rather than a bug. Functions start fresh, run for a limited time and then stop.

State belongs in a managed store, not in the function. Sessions go in a cache or database, uploads go in object storage, and long jobs are split into steps joined by a queue. A function that keeps state in memory will lose it without warning.

Cold starts happen when the platform starts a fresh copy of your function after a quiet period. Keep functions small, avoid heavy startup work and, where the platform offers it, use provisioned capacity only for the few functions where latency matters. Most background jobs never notice a cold start.

Timeouts cap how long one run can last, often at a few minutes. Split long work into chunks, process records in batches and let a queue retry failed chunks. A function that times out silently is worse than one that fails loudly, so log progress as it goes.

Example: moving a thumbnail job to serverless

Example (hypothetical): a small team runs a thumbnail service on a server that sits idle most of the day. Users upload about 120,000 images a month, and each thumbnail takes about 0.15 seconds of compute.

The team moves the job to a function triggered by each upload. Total compute is 120,000 runs times 0.15 seconds, which is 18,000 seconds, or 5 hours of compute a month. The old server ran 24 hours a day, or about 720 hours a month, so the team stops paying for roughly 715 idle hours.

The team also removes about 6 hours a month of patching and monitoring work for that server. The move takes two weeks of part-time work, and the thumbnail path keeps working because the old server stays live until the new path has handled a full month of uploads.

What are the common mistakes?

The most common serverless mistakes are moving too much at once, ignoring cost controls and treating functions like small servers. Each one is easy to avoid once you know to look for it.

  • Migrating the whole app first. A big-bang move hides failures and makes rollback hard. Move one workload, learn, then move the next.
  • No budget alert. Without an alert, a retry loop or a traffic spike shows up as a bill, not a warning.
  • Keeping state in the function. Memory does not survive between runs, so state kept there is lost.
  • Skipping logging. Functions that fail quietly are hard to debug. Log every run with a request id.
  • Ignoring the time limit. A job that runs longer than the limit will be cut off mid-way. Split long work into steps.
  • Over-provisioning memory. Memory size sets the price per unit of time, so the largest size costs the most even when the function is idle.

If you are weighing serverless against other models, serverless vs containers compares the trade-offs.

For help with the migration itself, DevOps services covers the design and rollout.

Key takeaways

  • Serverless means functions on managed infrastructure, not no infrastructure at all
  • Start with one small, stateless, event-driven workload and keep the old path live
  • Move state into managed stores, because functions cannot hold state between runs
  • Cost follows requests and compute time, so set a budget alert before launch
  • Cold starts, timeouts and retry loops are design problems, not surprises

Frequently asked questions

Does serverless mean I never manage servers?

No. The cloud provider manages the servers, but you still manage the code, configuration, permissions and data. Serverless removes patching and capacity planning, not ownership of the application itself or its security.

Which cloud providers offer serverless functions?

All major cloud providers offer function services, along with managed triggers such as HTTP gateways, queues and storage events. The concepts transfer between providers, though names, limits and pricing differ, so check the vendor documentation for the service you choose.

Is serverless cheaper than running a server?

It depends on traffic. Spiky or infrequent workloads are usually cheaper because you pay only when code runs. Steady, high-volume workloads can cost more than a reserved server, so compare the monthly bill for your actual traffic pattern before deciding.

What is a cold start in serverless?

A cold start is the delay when the platform starts a fresh copy of your function after a quiet period. It usually lasts well under a second for small functions, but it can matter for latency-sensitive APIs. Keeping functions small and warm reduces the effect.

Can serverless handle long-running jobs?

Not in one run. Functions have a time limit, so long jobs must be split into steps joined by a queue or a workflow service. Each step runs as its own function, which also makes failures easier to retry.

How do I debug a serverless function?

Use structured logs with a request id on every run, plus alerts on errors and timeouts. Since you cannot log into a server, logs and traces are the only view you have, so add them before the first production run.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: software products in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a move to serverless and unsure which workload to start with? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Cloud Services service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call