Serverless at Scale: How We Cut Costs Without Touching the Architecture That Was Working

Start Your Project

Service Image

Case Study

The Assessment Was the Intervention

HAMS reached out with a one-line brief: "We're paying too much. Can you take a look?" Behind that sentence was a serverless API that had been running in production for years, handling real-time geolocation resolution for multiple systems across the business. The bill was growing month over month, and no one had a clear picture of which part of the architecture was responsible.
Before touching anything, Renaiss spent the first weeks pulling real production metrics, mapping cost drivers, and building a precise picture of how the API actually behaved at scale. That assessment phase was the whole job. The numbers revealed two completely different problems: one cost that scaled correctly with business growth, and one structural inefficiency that would keep compounding regardless of what else was optimized.
CloudFront was processing 1.64 billion requests per month with a 97% cache hit ratio. Replacing it with API Gateway's native caching — a seemingly simpler option — would have cost $5,800–$6,475/month before accounting for degraded performance across geographies. CloudFront stayed. The EFS dependency didn't. Every Lambda invocation was mounting a remote volume to query the geolocation database — 47 million times a month. We migrated the function to a container image that packages both the code and the full database together. Remote I/O disappeared from the hot path, execution time dropped by 3×, and the billing line stopped compounding. The daily update cycle was preserved through an automated pipeline that rebuilds and deploys the image every 24 hours.

1.6B monthly requests — correctly priced

1.6B monthly requests — correctly priced

CloudFront wasn't the problem. The assessment showed a 97% cache hit ratio and a cost structure proportional to real business growth. Touching it would have cost more.

3x Lambda execution improvement

3x Lambda execution improvement

Removing the EFS network call from the critical path eliminated the main latency driver. The function now reads from a local file packaged in the container image.

EFS removed from the hot path

EFS removed from the hot path

47 million monthly invocations were mounting a remote volume at runtime. Migrating to a container image with an embedded database eliminated the ETDataAccess-Bytes billing line entirely.

Automated daily database refresh

Automated daily database refresh

The update cycle was preserved without the EC2 instance. A pipeline rebuilds the container image with the updated geolocation database every day and deploys it automatically.

Infrastructure as code — from day one (retroactively)

Infrastructure as code — from day one (retroactively)

The update cycle was preserved without the EC2 instance. A pipeline rebuilds the container image with the updated geolocation database every day and deploys it automatically.

Alerting coverage implemented

Alerting coverage implemented

The engagement surfaced a gap in observability that wasn't visible in the original brief. Alerting was put in place before handoff, not after the next incident.

How We Diagnosed a Serverless Bill — and Fixed the Part That Actually Needed Fixing

Start Your Project

Infrastructure Assessment

01 / 05

Cost Driver Analysis

02 / 05

CloudFront Evaluation

03/ 05

Lambda Migration to Container Image

04 / 05

Pipeline Automation & IaC

05 / 05

Infrastructure Assessment

We pulled real production metrics before making any recommendation. Cost attribution required understanding actual traffic patterns, cache behavior, and billing mechanics — not assumptions about what the architecture was supposed to do.

Cost Driver Analysis

Two separate cost centers emerged with different root causes. Distinguishing between a cost that scales correctly and one that compounds structurally determined which intervention made sense and which would have been a mistake.

CloudFront Evaluation

We modeled the cost of replacing CloudFront with API Gateway's native caching. The analysis showed a projected increase of $5,800–$6,475/month — before accounting for loss of global edge distribution. CloudFront was retained.

Lambda Migration to Container Image

We migrated the Lambda function from a traditional deployment package to a container image that embeds the full geolocation database. Remote I/O was removed from the execution path; execution time dropped by 3×.

Pipeline Automation & IaC

The EC2-based update script was replaced by an automated pipeline that rebuilds and deploys a new container image daily. The full stack was imported into Terraform, and alerting was implemented before handoff.

What is nearshore software development?

What time zone does Renaiss operate in?

What cloud services does Renaiss specialize in?

Do you work with AWS, Azure, or GCP?

Can Renaiss help us modernize a legacy application?