What a real SaaS API costs:
Spring Boot on Fargate vs. Lambda
Duty27 is our own product, an EU VAT calculation API running in production on AWS Lambda as GraalVM native images. This is what it costs to run, against what the same API would cost as the typical Spring Boot deployment: one container, always on, behind a load balancer.
Modeled 9 October 2026 for eu-central-1. The Lambda side is measured. The Fargate side is modeled, and says so wherever it matters.
Modeled at the minimum production setup: two tasks and a load balancer. Almost all of it is paid before the first request arrives.
Cost per request measured under load and scaled to 100,000, plus the measured cost of keeping it warm.
Shared costs (database, auth, CDN) are excluded from both. Neither figure is a total AWS bill.
Cost by traffic
| Requests/month | Spring Boot on Fargate | Lambda, as built | Lambda as % of Fargate |
|---|---|---|---|
| Idle | $75.76 | $0.05 | 0.1% |
| 100,000 | $75.76 | $0.23 | 0.3% |
| 1,000,000 | $75.78 | $1.88 | 2.5% |
| 10,000,000 | $75.92 | $18.34 | 24.2% |
| 50,000,000 | $76.58 | $91.47 | 119.5% |
| 100,000,000 | $101.77 | $182.90 | 179.7% |
The crossover is at 41.8 million requests a month. Below it, Lambda is cheaper, and at early-SaaS volume it is close to free. Above it, the always-on fleet wins and the gap widens. At 41.8M the Fargate side is still on its two-task floor, so the crossover does not depend on how much traffic one task can absorb.
The 100M row is the one figure that does. It assumes 50 requests per second per task at peak, a proxy taken from our benchmark rather than measured on this API.
Across a fleet
For one service, $76 a month is too small for most companies to notice. It adds up because nobody runs one service. A typical company runs several, each in dev, staging and prod, and every copy on Fargate pays its idle floor whether or not anyone calls it.
Ten services across three environments, deployed the way real teams do it: one load balancer per environment shared by every service, two tasks per service in prod, one in staging and dev.
| Component | Deployments | Running 24/7 | Monthly |
|---|---|---|---|
| Prod, Fargate | 10 | 20 tasks | $487.49 |
| Staging and dev, Fargate | 20 | 20 tasks | $487.49 |
| Shared load balancers, one per environment | 3 | $81.03 | |
| Spring Boot on Fargate, total | 30 | $1,056 | |
| Lambda, total | 30 | 0 | $1.53 |
$12,672 a year, before a single request
That is the idle cost of the fleet on Fargate. On Lambda it is $18. Giving every copy its own load balancer and two tasks would double the Fargate figure to $2,273 a month, but that is not how teams deploy, so it is not the number used here.
The Lambda side: measured
From a 350 virtual-user k6 load test on 21 September 2026: 51,411 VAT calculation requests, all returning 200, in a 10-minute window. Billed duration comes from every CloudWatch report line in that window. One API request fans out to three functions, all 512 MB on arm64.
| Function | Invocations | Billed ms | Cold starts |
|---|---|---|---|
| VAT calculation | 51,451 | 1,088,859 | 35 |
| JWT authorizer | 51,451 | 120,889 | 22 |
| VIES VAT validation | 15,390 | 87,977 | 8 |
That is 25.24 billed ms and 2.30 function invocations per API request, cold starts included.
| Per 1M API requests | Cost | Share |
|---|---|---|
| Lambda compute (25.24 ms at 512 MB) | $0.17 | 9% |
| Lambda requests (2.30 invocations each) | $0.46 | 25% |
| API Gateway HTTP API | $1.20 | 66% |
| All-in | $1.83 |
Where the money actually goes
The code is 9% of the bill. The other 91% is per-request fees: API Gateway, and invoking the authorizer and VIES validation as separate functions. Native compilation already made the compute cheap. What scales this bill is the architecture around it.
The Fargate side: modeled
A Spring Boot monolith serving the same API, sized like the Spring Boot deployment in our measured benchmark. Prices are eu-central-1 on-demand, read from AWS's published price files.
| Assumption | Value | Basis |
|---|---|---|
| Task size | 0.5 vCPU, 1 GB | Same as the Spring Boot side of our benchmark |
| Minimum tasks | 2 | A 54.5 s startup at this size rules out scale-to-zero |
| Network | Public subnets, ALB | Cheapest viable layout |
| Idle floor | $75.76/month | Tasks $41.45, ALB $19.71, public IPv4 $14.60 |
Moving the tasks into private subnets behind a NAT gateway, a common hardening step, would add about $31 a month net.
Left out of both sides
These cost the same either way, so including them would make the totals bigger without making the comparison truer.
- DynamoDB. On-demand billing, and a monolith would use the same tables.
- Cognito, email, CloudFront, WAF and CloudWatch Logs.
- The event-driven functions: sign-up triggers, scheduled VAT number rechecks, report workers. A Spring Boot shop would keep these as Lambdas or scheduled jobs too.
When the monolith wins
Past 41.8 million requests a month, the container is cheaper and stays cheaper. If we were there, the right first move would not be a migration. Two changes would push the crossover out:
Cache authorizer results. API Gateway can cache a Lambda authorizer's response. Today the authorizer runs on every request, accounting for one of the 2.30 invocations.
Replace API Gateway at high volume. It is $1.20 of the $1.83 per million requests. An Application Load Balancer in front of the functions bills by capacity used instead of per request.
Neither is worth doing at the volumes in the first four rows. Both are cheaper than rewriting the service.
What this does not prove
- The Fargate side is modeled. No Spring Boot build of this API exists, so its figures come from AWS pricing applied to the deployment shape our benchmark measured.
- The traffic tiers are illustrative volumes, not this API's actual traffic. What is measured is the cost per request under load and the idle cost of keeping it warm.
- The per-request cost is for one endpoint. VAT calculation is the core call, and about 30% of the test traffic went through VIES validation. Account and billing endpoints were not measured.
- Lambda's free tier is not applied. It would cover Lambda compute and request fees up to about 430,000 API requests a month. API Gateway has no always-free tier.
- A monolith could read the database less often, because one JVM caches across every request it serves. This API already caches VAT rates for 24 hours per instance, so the difference is probably small, but it favours Fargate.
What is your Spring Boot service costing at idle?
We run this model against your own deployment: your task sizes, your traffic, your region. You get the crossover point for your service, and a straight answer on whether moving it would pay for itself.
Book a free assessment