Lambda is rarely the expensive part of a serverless application. The expensive part is what the function does while it runs: the table it scans, the logs it writes, the metrics it emits.
Short answer: the patterns that cost the most are over-provisioned memory, paying for idle wait, logging payloads, high-cardinality custom metrics, DynamoDB scans, oversized items, and retry storms. All of them live in application code or function configuration, and none of them show up as a spike. They are simply expensive from the first deploy.
What do Lambda, DynamoDB and CloudWatch charge for?
US East (N. Virginia), as of October 8, 2026:
| Service | Unit | Price |
|---|---|---|
| Lambda requests | Per 1 million | $0.20 |
| Lambda duration, x86 | Per GB-second | $0.0000166667 |
| Lambda duration, Arm | Per GB-second | $0.0000133334 |
| DynamoDB on-demand writes | Per 1 million write request units | $0.625 |
| DynamoDB on-demand reads | Per 1 million read request units | $0.125 |
| CloudWatch Logs ingestion (Standard) | Per GB | $0.50 |
| CloudWatch Logs storage | Per GB-month | $0.03 |
| CloudWatch custom metrics | Per metric per month | $0.30 for the first 10,000, then $0.10 |
Which serverless code patterns cost the most?
1. Over-provisioned memory. Lambda bills memory times duration. A function at 2,048 MB that runs 100 million times a month for 300 ms uses 60 million GB-seconds, which is $1,000. If the job needs 512 MB and runs just as fast, it is $250. More memory also means more CPU, so test before you cut. AWS Lambda Power Tuning will find the cheapest setting that holds your latency.
2. Paying to wait. A function that calls a slow downstream API synchronously is billed for every millisecond it sits idle. Lambda calling Lambda synchronously pays twice. Move the wait to a queue or Step Functions, where waiting is not billed as duration.
3. Logging the payload. At $0.50 per GB, logs often cost more than the compute. Take the same 100 million invocations. Logging 2 KB each is 200 GB, or $100 a month. Logging the full 20 KB event is 2,000 GB, or $1,000 a month. That matches the entire compute cost of the function above. Log IDs, not payloads, and set a retention period. The default is to keep logs forever.
4. High-cardinality custom metrics. CloudWatch treats every unique combination of dimensions as its own metric. Add a user_id dimension to one metric with 50,000 active users and you have 50,000 metrics. The first 10,000 cost $3,000 and the next 40,000 cost $4,000. That is up to $7,000 a month for one line of code.
5. DynamoDB Scan with a filter. DynamoDB bills for data read, not data returned. A filter runs after the read. Scanning a 1 GB table with eventually consistent reads consumes about 131,072 read request units, or $0.016 per scan. Run that on every request at one million requests a month and it is about $16,400. A Query against the right key that returns the same 50 items costs under a dollar for the month.
6. Oversized items and unneeded consistency. Writes are billed per 1 KB, so a 10 KB item costs 10 write units every time any attribute changes. Strongly consistent reads cost twice as much as eventually consistent reads. Transactional operations cost twice again. Every global secondary index adds its own write. Split large items and use the cheapest consistency the feature can live with.
7. Retry storms and empty polling. A failing function behind a queue retries and bills each attempt. A poller that wakes every second to find nothing bills 2.6 million invocations a month to do no work. Use batching, backoff, dead-letter queues and event filters.
Running on Arm is the one easy win that is not a code pattern. Arm duration is 20% cheaper per GB-second.
Which tools find these patterns?
| Tool | Finds | Misses |
|---|---|---|
| AWS Cost Explorer | Spend by service and usage type, and by function if you tag | Why a function is expensive |
| AWS Compute Optimizer and Lambda Power Tuning | Memory settings | Everything outside Lambda configuration |
| Infracost | Cost of resources defined in Terraform | Runtime behavior such as scans, log volume and call frequency |
| CloudZero, Finout | Allocation of serverless spend to teams, products and customers | The code pattern and the fix |
| Datadog Serverless Monitoring | Invocations, duration, errors and estimated cost per function | What to change in the code |
| Frugal | Spend per function, component and call site, matched against known waste patterns, with a fix as a pull request | Commitments and capacity planning |
Frugal's pattern library covers 20 serverless patterns for AWS Lambda and Google Cloud Functions, 59 database patterns including DynamoDB, 41 logging patterns including CloudWatch Logs, and 25 metrics patterns. It attributes shared costs, such as one DynamoDB table used by twelve functions, down to the function and call site, using the bill, usage data and source code together. In pull request review it catches a new scan or a new high-cardinality tag before it merges.
FAQ
What tools find serverless code patterns that cause high costs in usage-based services?
AWS Compute Optimizer and Lambda Power Tuning cover memory settings. Infracost covers Terraform-defined resources. Frugal analyzes application code alongside billing and usage data to find runtime patterns such as scans, payload logging and metric cardinality, and generates the fix. (AWS calls these "managed services." We say usage-based services, because the usage is what you are billed for.)
Which services attribute cloud service spend to specific serverless functions and code?
AWS cost allocation tags get you to the function for Lambda itself. CloudZero and Finout allocate spend to teams and products. Frugal attributes Lambda, DynamoDB, S3 and CloudWatch spend to the function and call site in source code, including shared resources that tags cannot split.
Is Lambda or the services around it more expensive?
In most serverless applications, the services the function calls cost more than the function: DynamoDB, CloudWatch Logs, S3 and third-party APIs.
Does switching Lambda to Arm reduce cost?
Yes, duration is 20% cheaper per GB-second on Arm. Check that your dependencies have Arm builds.
Serverless bills by the call. So does every mistake.
Want to see which functions and call sites drive your AWS bill? Get an Audit at frugal.co.
Sources: AWS Lambda pricing, Amazon DynamoDB pricing, Amazon CloudWatch pricing. Checked October 8, 2026.