Skip to main content

Separating production and testing environments

The code that is inside the Lambda function is always the same, no matter if you are calling it from a local, staging or production environment.

Also, each render executed with Remotion Lambda is completely isolated from another, in terms of compute and storage.

Functions​

By default, each Lambda function has a configuration that determines its name:

  • Timeout
  • Memory size
  • Disk size
  • Remotion version

If you have the same configuration in different environments, you can reuse the same function since each execution is isolated. If your organization requires separate resources, use custom function names.

If you are changing the configuration in one environment, deploy a new function and leave the old one deployed.
This allows you to safely test new functions without breaking the other environments.
You don't incur any costs for functions that are deployed but not used.

Sites​

We recommend to scope the site to a specific environment using --site-name when creating a site. For example, use --site-name=remotion-production and --site-name=remotion-staging.

A site contains your React / Remotion code and might change frequently.
Make sure to update your site whenever you make changes to your code or upgrade Remotion, and to not use the site for other environments if they differ.

Buckets​

Just one bucket per region can be used for Remotion Lambda, but the resources in it can be scoped.

A bucket contains 2 folders:

  • sites/ folder for your sites
  • renders/ folder for your renders

You should scope your sites option when creating a site.
The renders are automatically scoped when rendering by creating subfolders with unique IDs within the renders/ folder.

It is safe to use the same bucket for all environments.
Use the privacy option to make renders private.
The sites must be public because they are accessed via HTTP.

Common questions​

Can I use a custom function name?​

Yes, from v4.0.540. See Custom Lambda function names. Pass the function name explicitly when rendering. Names outside the remotion-render- prefix also require updated IAM permissions.

The default name allows automatic discovery and speculateFunctionName(). Reusing one function can also improve warm-start reuse across environments.

What if I want to have two functions for two different projects?​

A function is not tied to a project.

Each function is a binary that contains the same code.
Every Remotion Lambda user runs the exact same code in their function.

The React code you write is not contained in the function, it is hosted on the Serve URL.

Each function invocation is isolated and they cannot conflict each other. There is a concurrency limit, but it is per region, not per function.

I need to separate production, staging and development​

Function invocations don't conflict each other.
Functions also don't contain any code that you write, they are binary and every Remotion Lambda user runs the exact same code.

It is impossible for a bad staging deployment to affect the production function.
Therefore, we recommend to use the same function for all environments.

I want to have different configurations for different functions​

This is supported! You can have multiple functions with different configurations.
Without a name override, functions are reused when they share the same configuration:

  • Timeout
  • RAM
  • Region
  • Disk size
  • Remotion version

To distinguish which function should be used, pass the function name explicitly to renderMediaOnLambda().
You can pass --function-name to npx remotion lambda render

I want to deploy multiple projects​

It is possible deploy multiple sites under different Serve URLs.
This convention only applies to functions, which do not contain any code that you write.

I want to deploy multiple functions to load-balance between them​

You do not need to do this, because you can invoke a function multiple times concurrently.
There is no concurrency limit per function, but a concurrency limit per region and account.
Therefore there is no benefit in having multiple identical functions in the same region and account for load-balancing.

See also​