How does AWS Lambda pricing work?
Instruction: Describe the AWS Lambda pricing model and what factors contribute to the cost.
Updated
Official answer
First identify the Lambda compute mode and Region. For standard on-demand Lambda Event Functions, the principal dimensions are billable requests and allocated-memory time in GB-seconds. Duration is rounded to the applicable billing increment; use billed-duration records rather than assuming the CloudWatch Duration metric includes every billable phase.
For example, 1,000 invocations allocated 512 MB and billed for 200 ms each consume 100 GB-seconds of compute usage: 1,000 × 0.5 GB × 0.2 seconds. Apply the current regional/architecture rate and request pricing separately. This calculation excludes discounts and other charges.
Request charging is not always one charge per source event. Current asynchronous-event pricing charges one request for the first 256 KB, with additional 64 KB chunks charged above that, up to the supported payload limit. Retries and invocation patterns can also affect usage. Confirm the relevant source and billing rules.
The published Event Functions free tier includes one million requests and 400,000 GB-seconds per month, subject to its terms; it does not apply to functions using provisioned concurrency. Provisioned concurrency, additional temporary storage, response streaming and some event-source modes can add charges. Managed Instances, MicroVMs and Web Functions have different pricing dimensions.
Include API Gateway, storage/database requests, logging, tracing, NAT and data transfer in the application estimate. Compare cost per successful business operation and consult current prices rather than treating more memory as automatically more expensive overall: shorter execution can outweigh the higher allocation.