aws_lambda_layer_version cost estimation
A Lambda layer version is free to publish and store. It packages shared dependencies for functions, and the cost stays on the Lambda functions that use it.
An aws_lambda_layer_version publishes a versioned archive of libraries or shared code that Lambda functions can attach and mount at runtime. Publishing and storing a layer has no charge. Layer storage counts toward the account's Lambda code storage quota (75 GB by default) but is not billed, so a layer sitting in your account costs nothing.
The cost stays with the aws_lambda_function that attaches the layer. Lambda bills per request and per GB-second of execution, calculated from the function's configured memory and its run duration. A layer's contribution is indirect: the unzipped layer counts toward the 250 MB deployment size limit and adds to what must be loaded on a cold start, which can lengthen initialization slightly. It does not add a per-layer meter.
Layers are actually a mild cost win. Sharing one copy of a heavy dependency set across many functions keeps each function's own package small, simplifies updates, and avoids duplicating the same megabytes in every function. c3x prices the Lambda functions that reference a layer by their memory, duration, and request volume, and treats the layer itself as the free shared artifact it is.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_lambda_layer_version" "deps" {
layer_name = "python-deps"
filename = "layer.zip"
compatible_runtimes = ["python3.12"]
source_code_hash = filebase64sha256("layer.zip")
}
resource "aws_lambda_function" "api" {
function_name = "api"
role = aws_iam_role.lambda.arn
handler = "app.handler"
runtime = "python3.12"
filename = "function.zip"
memory_size = 256
layers = [aws_lambda_layer_version.deps.arn]
}Pricing dimensions
What you actually pay for when you provision aws_lambda_layer_version.
| Dimension | Unit | What's being charged |
|---|---|---|
| Layer version | free | Publishing and storing a layer has no charge; it counts toward the code storage quota only. $0 |
| Function requests | per 1M requests | The functions that attach the layer are billed per invocation. $0.20 per 1M requests |
| Function duration | per GB-second | Memory times run time on the functions that use the layer. $0.0000166667/GB-second |
Optimization tips
Common ways to reduce aws_lambda_layer_version cost without changing the workload.
Share heavy dependencies with a layer
One layer used by many functions keeps each function package small and avoids duplicating the same megabytes, which speeds deploys and simplifies updates.
Keep the unzipped layer small
Layer contents count toward the 250 MB unzipped limit and are loaded on cold starts. Trim unused files so initialization stays fast and functions can keep lower memory settings.
Prune old layer versions
Every published version is retained and counts toward the 75 GB code storage quota. Delete versions no function references to stay under the quota.
FAQ
Does a Lambda layer cost money?
No. Publishing and storing a layer version is free. It counts toward your account's Lambda code storage quota but is not billed. Cost stays on the functions that attach it, billed per request and GB-second.
Do layers make Lambda more expensive?
Not directly. A layer adds no meter. It can slightly lengthen cold-start initialization by adding code to load, but sharing dependencies through a layer usually keeps function packages smaller and simpler.
How many layer versions can I keep?
As many as fit in the 75 GB Lambda code storage quota, which layers count toward. There is no per-version charge, but pruning versions no function uses keeps you under the quota.
Related resources
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_lambda_layer_version.