Skip to main content

estimatePrice()

Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size based on the AWS Lambda pricing matrix.

During rendering, many Lambda functions are spawned:

  • The main function normally spawns worker functions, waits for chunks to be rendered, and stitches them together for the full video. This is the longest-running Lambda function.
  • Renderer functions render a short portion of a video and then shut down. From v4.0.517, you can set concurrency to 1 to render the video on the main function.
  • Other short-lived, negligible functions get launched for initializing lambdas and fetching progress.

The total duration is the sum of execution duration of all of the above Lambda functions. This duration can be passed to estimatePrice() to estimate the cost of AWS Lambda.

The calculated duration does not include costs for S3 and Remotion licensing fees.

Example​

import { estimatePrice } from "@remotion/lambda";

console.log(
  estimatePrice({
    region: "us-east-1",
    durationInMilliseconds: 20000,
    memorySizeInMb: 2048,
    diskSizeInMb: 2048,
    lambdasInvoked: 1,
  })
); // 0.00067

Arguments​

An object containing the following parameters:

region​

The region in which the Lambda function is executed in. Pricing varies across regions.

memorySizeInMb​

The amount of memory that has been given to the Lambda function. May be received with getFunctionInfo().

durationInMilliseconds​

The estimated total execution duration in Milliseconds of all Lambdas combined. See the top of this page for a guide on how to approximate the duration.

lambdasInvoked​

The number of lambdas that were invoked in the rendering process.

diskSizeInMb​

The amount of disk space allocated in megabytes.

Return value​

The estimated cost in USD as a number.

Compatibility​

ServersEnvironments
Node.js
Bun
Serverless Functions
Node.js runtime

For serverless functions, use the light client.

See also​