A team deploying 50 Lambda functions processing 10 million invocations a month pays around 20 USD in compute, approximately, depending on memory allocation and execution duration.
That same team, running a two-task ECS cluster on Fargate 24/7, would pay closer to 30 USD a month in Fargate alone, plus the load balancer. The gap looks small until you scale to 200 functions or 20 tasks, where pricing diverges completely.
Serverless or containers: the decision behind your monthly bill
Lambda charges by GB-second and by million requests. Fargate charges by vCPU-hour and by GB-hour. That pricing structure already tells you something: Lambda scales to zero, Fargate holds a constant baseline.
The decision comes down to two variables: traffic pattern and tolerable latency. If your application gets unpredictable bursts with long idle periods, like webhooks or image processing under 100 sustained requests per second, Lambda wins.
Cold start on Node.js 20.x runs 200-400ms, dropping under 100ms with SnapStart on Java 21. If your service needs consistent sub-50ms latency at p99 running continuously, a container on ECS or EKS with Fargate gives that control.
- Lambda fits unpredictable bursts with long idle periods, like webhooks or image processing under 100 sustained requests per second.
- Fargate fits services needing consistent sub-50ms p99 latency running continuously.
- Fargate Spot cuts task cost up to 70% for workloads that tolerate interruptions, like batch processing workers.
- For critical workloads, combining standard Fargate and Fargate Spot with weighted capacity providers lets the scheduler distribute by availability.
How to build a solid CI/CD pipeline
Once you know where your code runs, the question is how it gets there repeatably. CodePipeline orchestrates the flow, CodeBuild compiles and tests, CodeDeploy runs the deployment. Repository structure shapes everything downstream.
For a project combining Flutter web and Next.js as frontends with a Nest backend running on Lambda or Fargate, the pipeline needs at least three stages.
A buildspec file at the root of each service defines what runs in CodeBuild: pulling dependencies, running the release build, and packaging the output artifacts, the kind of setup that also needs revisiting after a major Flutter version upgrade.
For Next.js with SSR, the build produces a standalone output that deploys to Lambda@Edge or a Fargate container, depending on the framework's output mode.
The output goes straight to an S3 bucket serving as a CloudFront origin, with a CDN invalidation closing the cycle, the same pattern we use for static storefronts in ecommerce projects.
Separating pipelines per service inside the monorepo stops a frontend change from triggering a backend build.
A folder structure like services/api, clients/flutter-web, and clients/nextjs-app lets each buildspec point to its own directory.
CodePipeline v2 supports triggers by path filter through the GitHub v2 connection, which avoids unnecessary builds and cuts CodeBuild costs.
At Somnio we run this setup on projects combining Flutter, Next.js, and AWS as the delivery stack, part of our full product development work recognized in Clutch's ranking of fastest-growing companies.
With more than 170 applications built, we have seen that pipeline automation defines a team's real velocity. When CI/CD is set up well, a 4-5 person squad can ship 15-20 deploys a week without friction.
Database and storage for your actual load
Database choice is where the most budget gets lost from decisions made in week one and never revisited.
A team that starts with RDS PostgreSQL because "we already know it" can end up paying several times more scaling concurrent connections that DynamoDB would have handled at a fraction of the cost on-demand.
Pricing as of early 2026, verify current rates on AWS's pricing pages before budgeting.
Option · Cost model · Typical latency · SLA
DynamoDB on-demand · 1.25 USD per million writes, 0.25 USD per million reads · Single-digit milliseconds · 99.999% on global tables
RDS PostgreSQL Multi-AZ · Per instance-hour plus 0.115 USD/GB/month on gp3 storage · 2-5ms per simple query · 99.95%
Aurora Serverless v2 · 0.12 USD per ACU-hour (scales 0.5 to 128 ACUs) · Comparable to RDS · 99.95%
For a fully serverless web application, the minimum viable stack is API Gateway plus Lambda plus DynamoDB plus S3 plus CloudFront.
That combo covers API, compute, data, static files, and CDN. If your Flutter web or Next.js frontend generates static files, S3 stores them cheaply and CloudFront delivers with sub-50ms latency globally.
The decision between DynamoDB and RDS comes down to a question nobody wants to answer early: is your data access pattern defined, or will it change? If you know your access patterns from day one, DynamoDB gives predictable performance and linear cost.
If your team needs ad-hoc joins, analytical reporting, or the schema will evolve with queries you cannot anticipate today, PostgreSQL on RDS or Aurora gives that flexibility at higher operational cost.
Architecture that connects to the business
Every technical decision affects three metrics any CTO cares about: monthly infrastructure cost, average deploy time, and availability measured in SLOs.
In our experience, a well-segmented pipeline with path filters meaningfully cuts CI spend compared to monolithic builds, since builds only run for the packages a given change actually touches.
Choosing DynamoDB over RDS for known access patterns can lower data costs while pushing SLA from 99.95% to 99.999%.
None of these decisions happen in isolation. The compute you choose shapes your pipeline, your pipeline shapes iteration speed, and your database shapes what every new feature costs to ship, the kind of foundation we lay out during product discovery before any code gets written.
Frequently asked questions
Does it make sense to start a new project directly on Fargate instead of Lambda?
It depends on the traffic pattern you expect. If the service runs continuously and you need predictable latency, Fargate is a solid choice from the start. If traffic is sporadic, Lambda lets you validate without paying for idle capacity.
What happens with Lambda cold starts in production?
With Node.js 20.x runtime, cold start runs 200-400ms, acceptable for most APIs without sub-50ms p99 SLOs. For Java functions, SnapStart on Java 21 brings that number under 100ms.
When does Aurora Serverless v2 make more sense than standard RDS PostgreSQL?
Aurora Serverless v2 is interesting with unpredictable load spikes and no desire to provision fixed instances. If load is stable and predictable, RDS PostgreSQL is usually cheaper, since Aurora Serverless v2 bills by ACU-hour and can cost more under sustained load.
How do you stop a frontend change from triggering backend builds in a monorepo?
CodePipeline v2 supports triggers by path filter through the GitHub v2 connection, letting each pipeline react only to changes inside its own directory.
Is DynamoDB viable if the team only has relational database experience?
DynamoDB requires defining access patterns before designing the schema, a real mindset shift. If the team needs ad-hoc joins or the data model is still undefined, PostgreSQL on RDS or Aurora is safer short-term.
Getting compute, pipeline, and database right in week one is what let a 4-5 person squad ship 15-20 deploys a week without friction on projects we have built through full product development.
If you're searching for a trusted software development partner, look no further. Contact us today to learn how we can help you turn your vision into reality with our tailored, high-quality solutions.

.png)

