# Deploying Remotion Lambda: A Complete Guide to Serverless Video Rendering

> Deploy Remotion Lambda effortlessly for serverless video rendering. Our guide covers CLI and programmatic deployment using the @remotion/lambda package for efficient video creation.

- Repository: [Remotion/remotion](https://github.com/remotion-dev/remotion)
- Tags: how-to-guide
- Published: 2026-02-16

---

**Deploying Remotion Lambda involves using the `@remotion/lambda` package to create an AWS Lambda function that renders videos serverlessly, either via the CLI command `remotion lambda functions deploy` or programmatically through the `deployFunction()` API.**

Deploying Remotion Lambda is the standard way to render Remotion videos at scale without managing servers. The `@remotion/lambda` package provides a complete deployment pipeline that packages your Remotion runtime into an AWS Lambda function, handling versioning, validation, and infrastructure configuration automatically.

## How Remotion Lambda Deployment Works

### The Three-Layer Architecture

The deployment system consists of three distinct layers that work together to create your Lambda function.

The **Client API** layer, located in [`packages/lambda/src/api/deploy-function.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/api/deploy-function.ts), validates inputs, builds the function name, and calls the low-level implementation. This is what you interact with when using `deployFunction()` programmatically.

The **CLI** layer in [`packages/lambda/src/cli/commands/functions/deploy.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/cli/commands/functions/deploy.ts) parses command-line flags, prints progress bars, and forwards requests to the client API. This provides the `remotion lambda functions deploy` command.

The **Server-side implementation** in [`packages/lambda/src/functions/aws-server-implementation.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/functions/aws-server-implementation.ts) creates the actual Lambda function, uploads the bundled code from [`packages/lambda/src/shared/function-zip-path.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/shared/function-zip-path.ts), and configures CloudWatch, VPC, runtime settings, and optional Lambda Insights.

### Deployment Flow and Version Safety

When deploying Remotion Lambda, the system follows a strict validation pipeline to prevent configuration drift.

First, the client API calculates a deterministic function name using `speculateFunctionName` based on memory, timeout, and disk size. This ensures identical configurations reuse the same Lambda, preventing function sprawl.

Next, the system checks the `VERSION` constant from [`remotion/version.ts`](https://github.com/remotion-dev/remotion/blob/main/remotion/version.ts) against any existing Lambda. If a function exists with the same configuration but a different Remotion version, the deployment creates a new function rather than reusing the incompatible one.

Finally, shared validators in `packages/lambda/src/shared/*` check memory limits, timeout ranges, VPC settings, and custom role ARNs before any AWS API calls are made.

## Deploying Remotion Lambda from the CLI

### Installation and Prerequisites

Before deploying, install the Lambda helper package and ensure you have AWS credentials configured with permissions to create Lambda functions, IAM roles, and CloudWatch log groups.

```bash
npm install @remotion/lambda --save-exact

```

### CLI Deployment Command

Deploy a Remotion Lambda function using the CLI command defined in [`packages/lambda/src/cli/commands/functions/deploy.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/cli/commands/functions/deploy.ts):

```bash
remotion lambda functions deploy \
  --region us-east-1 \
  --memory 2048 \
  --timeout 900 \
  --disk 1024 \
  --enable-lambda-insights

```

This command packages the pre-built ARM64 binary from [`packages/lambda/src/shared/function-zip-path.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/shared/function-zip-path.ts), creates the Lambda function with 2GB RAM and 15-minute timeout, and enables CloudWatch Lambda Insights for monitoring. The CLI prints a progress bar and returns the function name upon completion.

## Deploying Remotion Lambda Programmatically

### Using the deployFunction API

For automated pipelines or custom applications, deploy Remotion Lambda programmatically using the `deployFunction` export from [`packages/lambda/src/api/deploy-function.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/api/deploy-function.ts):

```typescript
import {deployFunction} from '@remotion/lambda';

const {functionName} = await deployFunction({
  region: 'us-east-1',
  memorySizeInMb: 2048,
  timeoutInSeconds: 900,
  diskSizeInMb: 1024,
  createCloudWatchLogGroup: true,
  enableLambdaInsights: true,
  customRoleArn: 'arn:aws:iam::123456789012:role/MyLambdaRole',
});

```

The API returns the deployed function name, which you can use immediately to invoke renders. The `deployFunction` wrapper applies default values, handles deprecation warnings, and delegates to `internalDeployFunction` for the actual AWS operations.

## Key Configuration Options

When deploying Remotion Lambda, several parameters in [`packages/lambda/src/shared/validate.ts`](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/shared/validate.ts) control the execution environment:

- **Memory**: Specify between 512MB and 10240MB in 1MB increments. Higher memory allocates more CPU and network bandwidth.
- **Timeout**: Set between 1 and 900 seconds (15 minutes). Longer timeouts accommodate complex renders but increase costs.
- **Disk Size**: Configure ephemeral `/tmp` storage between 512MB and 10240MB for caching frames or downloading assets.
- **Custom Role**: Provide a `customRoleArn` to use existing IAM permissions instead of the default role created by Remotion.
- **Lambda Insights**: Enable CloudWatch Lambda Insights for enhanced monitoring and tracing.

All options are validated against AWS Lambda limits before deployment begins, preventing partial infrastructure creation.

## Summary

Deploying Remotion Lambda provides a serverless rendering pipeline that automatically handles packaging, versioning, and infrastructure configuration. Key takeaways include:

- Use the **CLI** (`remotion lambda functions deploy`) for manual deployments and the **`deployFunction` API** for automated workflows.
- The deployment system uses **deterministic function naming** to prevent duplicate Lambda functions with identical configurations.
- **Version safety** ensures that Remotion runtime updates create new Lambda functions rather than breaking existing deployments.
- All configuration options are **validated** against AWS limits before any infrastructure changes occur.

## Frequently Asked Questions

### What is the minimum memory required to deploy Remotion Lambda?

The minimum memory required is **512MB**. However, for rendering 1080p videos, Remotion recommends at least **2048MB** to ensure adequate CPU allocation and prevent timeout errors during complex renders.

### How does Remotion prevent duplicate Lambda deployments?

Remotion uses **deterministic function naming** via the `speculateFunctionName` utility. The function name is calculated from the memory size, timeout, disk size, and Remotion version. If a function with that exact name already exists, Remotion reuses it instead of creating a duplicate, preventing infrastructure sprawl.

### Can I use a custom IAM role when deploying Remotion Lambda?

Yes. Pass the `customRoleArn` parameter to the `deployFunction` API or use the `--custom-role-arn` flag in the CLI. This allows you to use existing IAM permissions instead of the default role that Remotion automatically creates. The role ARN is validated against AWS IAM patterns before deployment.

### What happens if I upgrade Remotion after deploying a Lambda function?

When you upgrade Remotion, the `VERSION` constant in [`remotion/version.ts`](https://github.com/remotion-dev/remotion/blob/main/remotion/version.ts) changes. During the next deployment, Remotion detects that existing functions use a different version and creates a **new Lambda function** with the updated runtime rather than reusing the old one. This prevents version mismatches that could cause runtime errors during video rendering.