Running on AWS Lambda?

Lambda cold, timing out, or billing more than expected? We ship it properly.

Most Lambda functions we are asked to look at are either doing too much per invocation, carrying more dependencies than they need, or wired to a VPC that doubles cold start times for no good reason. We profile the real traffic, trim what is there, and push cost and latency back to where they ought to be.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

lambda-cloudwatch.log

still failing

What it is

AWS Lambda at a glance

AWS Lambda is Amazon's serverless compute service, launched at re:Invent 2014. You upload a function, Lambda runs it on demand in response to triggers from the rest of AWS, and you are billed by the millisecond of execution with a hard 15 minute ceiling per invocation.

The service supports native runtimes for Node.js, Python, Java, .NET, Go, and Ruby, as well as custom runtimes via container images up to 10 GB. Lambda is commonly used for event-driven backends, data pipelines on S3 and Kinesis, API Gateway integrations, cron-style scheduled jobs through EventBridge, and glue code between other AWS services.

Type
Serverless compute, function-as-a-service
First released
2014 general availability
License
Proprietary, pay-per-invocation and GB-second
Maintained by
Amazon Web Services, Inc.
Typically used for
Event-driven APIs, scheduled jobs, S3 and Kinesis processing, SaaS integrations, glue between AWS services

The honest version

AWS Lambda pros and cons

No technology is all upside. This is where AWS Lambda earns its place and where it tends to cause trouble.

Where AWS Lambda is strong

  • No servers to look afterNo instances to patch, no autoscaling groups to size. Lambda runs the function and you stop thinking about the host underneath.
  • Scales to zero and to thousandsAn idle function costs nothing, and a bursty workload is fronted by concurrent executions without any intervention. Few other compute models do both.
  • Deep AWS integrationS3 events, DynamoDB streams, SQS queues, API Gateway and EventBridge rules wire straight into Lambda without a line of glue code.
  • Granular billingPriced per millisecond and GB-second, rounded down to 1 ms since 2020. Small workloads can run for pennies a month.
  • Container image supportFunctions can ship as OCI images up to 10 GB, which removes the old pain of packaging large dependency trees inside a zip.
  • Good language coverageManaged runtimes for Node, Python, Java, Go, .NET and Ruby cover most teams, and custom runtimes handle the rest through the Runtime API.

Where AWS Lambda bites

  • Cold starts can be loudA fresh JVM or a Lambda tied to a VPC can take several seconds to initialise. For a user-facing API that lands as a spike in p99 latency every time traffic ramps up.
  • The 15 minute ceiling is hardAnything longer has to be split into step functions, moved to Fargate, or pushed onto a worker. Large ETL jobs regularly hit this limit.
  • Observability has sharp edgesCloudWatch Logs is fine for one function and awkward for 40. Distributed traces need X-Ray or a third party, and both cost real money at volume.
  • Billed duration catches people outA function that waits on a slow downstream API still bills for the wait. Pay-per-ms sounds cheap until the downstream decides to take a nap.
  • Deployment packages have limits250 MB unzipped for zip packages, 10 GB for images. Fat SDK bundles and ML models bump against these more often than teams expect.
  • Concurrency limits existDefault regional concurrency is 1,000. A spike of traffic can throttle real production work, and the quota increase takes a support case and a few days.

Sound familiar?

Common AWS Lambda problems we fix

The AWS Lambda problems that bring people to us, and what you have once each one is fixed.

Task timed out after 15.00 seconds

Functions keep timing out

A downstream service that is slow, a loop over records that has grown larger than the timeout allows, or a database query without an index. The function hits the ceiling and the client sees a 502.

Within budget or moved off Lambda

Init Duration: 4821.44 ms

Cold starts are visible to users

A Java function in a VPC with ENIs to attach, or a Node bundle loading every AWS SDK client at the top of the file. Cold starts punish anything latency-sensitive.

Cold starts measured in hundreds of ms

Max Memory Used: 511 MB of 512

The function is at the memory ceiling

An image resize, a PDF rendering job, or a data transform that has grown past the memory configured for the function, leading to OOMs under load.

Right-sized, with headroom

Billed Duration climbing

The invoice has quietly doubled

A function that waits on a slower API, a step function fanning out more invocations than it needs to, or memory tuned high because an engineer wanted more CPU.

Hot paths cheaper, invoice back down

Runtime.ImportModuleError

Modules missing in the package

A dependency that was assumed to be in the base image but no longer is, or a Node layer with a Python version mismatch, breaking cold starts for every invocation.

Dependencies pinned in the artifact

ConcurrentInvocationLimitExceeded

Lambda is throttling production traffic

A spike that pushed over the regional concurrency quota, or one noisy function starving the rest of the account. We rebalance or reserve concurrency and then raise the quota properly.

Headroom secured, noisy neighbour tamed

Provisioned concurrency: not enough capacity

Provisioned concurrency is not holding

A deployment invalidated the warm pool, auto-scaling has not caught up, or the function configuration changed and tripped a reset. The warm path is suddenly cold.

Warm fleet steady across deploys

no IaC on these functions

Functions were created by hand in the console

Permissions bolted on with wildcards, environment variables set directly in the UI, triggers wired by click rather than by code. Nothing to review, nothing to rebuild.

Functions described in Terraform or SAM

What we do

Lambda help, from rescue to tuning

Ring us for one function that is timing out, or hand us the serverless estate.

Rescue
Timeouts, throttles, failing deploys. We stabilise the function first and dig into the root cause once traffic is healthy.
Performance tuning
Cold start profiling, memory sizing against real workloads, Lambda SnapStart or provisioned concurrency applied only where it earns its keep.
Cost review
CloudWatch Insights queries over billed duration and memory usage, a short list of changes with the invoice impact on each one.
Architecture
Choosing Lambda versus Fargate versus ECS honestly, with the long-running and expensive workloads moved somewhere that fits them.
IaC migration
Pulling console-built functions into Terraform, CDK or SAM, with the triggers and permissions described rather than clicked.
Managed Tech
Monthly cost and latency reviews across the function set, a watch on quotas before a spike hits them, and an engineer who already knows the account when a page arrives after dark.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running AWS Lambda alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

AWS Lambda questions

Something else? Call+1 737 727 7327

Why are our Lambda cold starts so slow?

The usual causes are a VPC attachment that forces ENI setup on each new execution environment, a large dependency bundle loaded at module scope, and a runtime like the JVM or .NET that simply takes longer to boot. We move initialisation out of the module scope, trim the bundle, and only use provisioned concurrency once the cheaper fixes are in.

Why has our Lambda bill jumped this month?

Billed duration is the single biggest driver on most invoices, so anything that makes the function take longer costs more. A slow downstream API, a loop over a table that has grown, or a memory bump a developer made for extra CPU are all common causes. We query CloudWatch for duration percentiles and name the culprit function by function.

How do we handle the 15 minute Lambda timeout?

Either the work itself has to be shortened, or it has to move off Lambda. Step Functions can split a long pipeline into many short invocations, Fargate or ECS can run anything that genuinely needs an hour, and SQS plus a worker is right for most batch jobs. We pick the path that costs least and breaks least.

Should we pick Lambda or Cloudflare Workers?

Lambda if the function is heavier than ten milliseconds of CPU, needs a specific language runtime, or depends on the wider AWS catalogue. Workers if the code belongs on the request path and must be close to the user. Mixing both on one project is fine when each one is doing what it is good at.

How do we move console-created Lambdas into Terraform?

We export the current configuration, rebuild it as a module with the triggers and IAM policies as code, deploy a second copy in a non-production account to confirm parity, and then import or replace the live function during a planned window. The point is to end up with an account that can be rebuilt from Git, not one that has been clicked together.

How much does AWS Lambda help cost?

The initial estimate is free. Share the function name or the CloudWatch log group and what is going wrong, and we return a scope with a number before anything is changed.

Free estimate

Lambda giving you grief?

Tell us what you're running and what's going wrong. A person reads it and comes back with an estimate.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.