Skip to main content

deployFunction()

Creates an AWS Lambda function in your AWS account that will be able to render a video in the cloud.

If a function with the same version, memory size and timeout already existed, it will be returned instead without a new one being created. This means this function can be treated as idempotent.

Example​

ts
import { deployFunction } from "@remotion/lambda";
 
const { functionName } = await deployFunction({
region: "us-east-1",
timeoutInSeconds: 120,
memorySizeInMb: 2048,
createCloudWatchLogGroup: true,
diskSizeInMb: 2048,
});
console.log(functionName);
ts
import { deployFunction } from "@remotion/lambda";
 
const { functionName } = await deployFunction({
region: "us-east-1",
timeoutInSeconds: 120,
memorySizeInMb: 2048,
createCloudWatchLogGroup: true,
diskSizeInMb: 2048,
});
console.log(functionName);

Arguments​

An object with the following properties:

region​

The AWS region which you want to deploy the Lambda function too. It must be the same region that your Lambda Layer resides in.

timeoutInSeconds​

How long the Lambda function may run before it gets killed. Must be below 900 seconds. We recommend a timeout of 120 seconds or lower - remember, Remotion Lambda is the fastest if you render with a high concurrency. If your video takes longer to render, the concurrency should be increased rather than the timeout.

memorySizeInMb​

How many megabytes of RAM the Lambda function should have. By default we recommend a value of 2048MB. You may increase or decrease it depending on how memory-consuming your video is. The minimum allowed number is 512, the maximum allowed number is 10240. Since the costs of Remotion Lambda is directly proportional to the amount of RAM, we recommend to keep this amount as low as possible.

createCloudWatchLogGroup​

boolean

Whether logs should be saved into CloudWatch. We recommend enabling this option.

cloudWatchLogRetentionPeriodInDays​

optional

Retention period for the CloudWatch Logs. Default: 14 days.

diskSizeInMb​

optional

Sets the amount of disk storage that is available in the Lambda function. Must be between 512MB and 10240MB (10GB). Default: 2048MB. Set this higher if you want to render longer videos. See also: Disk size

customRoleArn​

optional

Use a custom role for the function instead of the default (arn:aws:iam::[aws-account-id]:role/remotion-lambda-role)

enableLambdaInsightsv4.0.61​

Enable Lambda Insights in AWS CloudWatch. For this to work, you may have to update your role permission.

Return value​

An object with the following values:

  • functionName (string): The name of the function just created.
  • alreadyExisted: (boolean): Whether the creation was skipped because the function already existed.

See also​