Skip to content

πŸŽ₯ Make videos programmatically with React

Docs: Separate environments for Lambda

JonnyBurger72c1eac195e8
diff --git a/packages/docs/docs/editor-starter/rendering.mdx b/packages/docs/docs/editor-starter/rendering.mdx
index 53498f72b2..ef0f449427 100644
--- a/packages/docs/docs/editor-starter/rendering.mdx
+++ b/packages/docs/docs/editor-starter/rendering.mdx
@@ -66,7 +66,7 @@ To make the deployment more robust, we recommend to separate production deployme
export const SITE_NAME = process.env.VERCEL_ENV === 'production' ? 'remotion-editor-starter' : 'remotion-editor-starter-dev';
```
-[You don't need to separate function deployments between production and development](/docs/lambda/naming-convention#i-need-to-separate-production-staging-and-development).
+[You don't need to separate function deployments between production and development](/docs/lambda/separate-environments).
## Rendering
diff --git a/packages/docs/docs/lambda/naming-convention.mdx b/packages/docs/docs/lambda/naming-convention.mdx
index 5dedb62834..d4f6cf07bc 100644
--- a/packages/docs/docs/lambda/naming-convention.mdx
+++ b/packages/docs/docs/lambda/naming-convention.mdx
@@ -9,7 +9,7 @@ crumb: 'Lambda'
A Remotion Lambda function has the following naming convention:
```
-remotion-render-4-0-140-mem2048mb-disk2048mb-240sec
+remotion-render-4-0-372-mem2048mb-disk2048mb-240sec
^^^^^^^ ^^^^ ^^^^ ^^^
| | | |-- Timeout in seconds
| | |--------- Disk size in MB
@@ -20,62 +20,13 @@ remotion-render-4-0-140-mem2048mb-disk2048mb-240sec
When you deploy a function, the name is hardcoded. This has two functions:
- <Step>1</Step> Avoid having multiple functions with the same configuration unnecessarily.
-- <Step>2</Step> Being able to guess the function name using <a href="/docs/lambda/speculatefunctionname">
+- <Step>2</Step> Being able to guess the function name using
+ <a href="/docs/lambda/speculatefunctionname">
<code>speculateFunctionName()</code>
- </a> so you don't have to fetch a list of functions in your AWS account.
-
-## Why can't I rename the function?
-
-- The [`npx remotion lambda render`](/docs/lambda/cli/render) command looks for functions that match this convention.
-- With the default user policy, Remotion Lambda restricts itself from accessing functions that don't match this convention.
-- You can use the [`speculateFunctionName()`](/docs/lambda/speculatefunctionname) function save one API call.
-- The function is more likely to be warm from a previous invocation if you only have 1 function with the same configuration.
-- There is no benefit to renaming the function.
-
-## 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](/docs/lambda/troubleshooting/rate-limit#default-concurrency-limits), 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.
-It is only not possible to have multiple functions that share the exact same configuration:
-
-- Timeout
-- RAM
-- Region
-- Disk size
-- Remotion version
-
-To distinguish which function should be used, pass the function name explicitly to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda).
-You can pass [`--function-name`](/docs/lambda/cli/render#--function-name) to [`npx remotion lambda render`](/docs/lambda/cli/render)
-
-## I want to deploy multiple projects
-
-It is possible deploy multiple sites under different [Serve URLs](/docs/terminology/serve-url).
-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.
+ </a>
+ so you don't have to fetch a list of functions in your AWS account.
## See also
- [`speculateFunctionName()`](/docs/lambda/speculatefunctionname)
+- [/docs/lambda/separate-environments](/docs/lambda/separate-environments)
diff --git a/packages/docs/docs/lambda/separate-environments.mdx b/packages/docs/docs/lambda/separate-environments.mdx
new file mode 100644
index 0000000000..d58e4d37b8
--- /dev/null
+++ b/packages/docs/docs/lambda/separate-environments.mdx
@@ -0,0 +1,108 @@
+---
+image: /generated/articles-docs-lambda-separate-environments.png
+id: separate-environments
+title: Separating production and testing environments
+sidebar_label: Separating environments
+slug: /lambda/separate-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
+
+Each Lambda function has a configuration that determines its unique name:
+
+- Timeout
+- Memory size
+- Disk size
+- Remotion version
+
+If you have the same configuration in different environments, you can safely re-use the same function since each execution is isolated – in fact, duplicating the function is not supported because it achieves nothing.
+
+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`](/docs/lambda/cli/sites/create#--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](#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`](/docs/lambda/rendermediaonlambda#privacy) option to make renders private.
+The sites must be public because they are accessed via HTTP.
+
+## Common questions
+
+### Why can't I rename the function?
+
+- The [`npx remotion lambda render`](/docs/lambda/cli/render) command looks for functions that match this convention.
+- With the default user policy, Remotion Lambda restricts itself from accessing functions that don't match this convention.
+- You can use the [`speculateFunctionName()`](/docs/lambda/speculatefunctionname) function save one API call.
+- The function is more likely to be warm from a previous invocation if you only have 1 function with the same configuration.
+- There is no benefit to renaming the function.
+
+### 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](/docs/lambda/troubleshooting/rate-limit#default-concurrency-limits), 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.
+It is only not possible to have multiple functions that share the exact same configuration:
+
+- Timeout
+- RAM
+- Region
+- Disk size
+- Remotion version
+
+To distinguish which function should be used, pass the function name explicitly to [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda).
+You can pass [`--function-name`](/docs/lambda/cli/render#--function-name) to [`npx remotion lambda render`](/docs/lambda/cli/render)
+
+### I want to deploy multiple projects
+
+It is possible deploy multiple sites under different [Serve URLs](/docs/terminology/serve-url).
+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
+
+- [Function naming convention](/docs/lambda/naming-convention)
+- [Upgrading Remotion Lambda](/docs/lambda/upgrading)
diff --git a/packages/docs/docs/lambda/upgrading.mdx b/packages/docs/docs/lambda/upgrading.mdx
index f88057ae67..ad4ecb98e6 100644
--- a/packages/docs/docs/lambda/upgrading.mdx
+++ b/packages/docs/docs/lambda/upgrading.mdx
@@ -5,12 +5,12 @@ title: Upgrading Lambda
slug: /lambda/upgrading
---
-import {Prerelease} from "../../components/PrereleaseVersion"
+import {Prerelease} from '../../components/PrereleaseVersion';
- Determine the newest version from the [Releases page](https://github.com/remotion-dev/remotion/releases).
- Upgrade all packages to the newest version (`@remotion/lambda`, but also `remotion`, `@remotion/cli` etc.)
-<Prerelease onlySnippet packageName="@remotion/lambda"/>
+<Prerelease onlySnippet packageName="@remotion/lambda" />
- (Optional): Remove the old versions of the function:
@@ -51,3 +51,5 @@ If you already shipped Remotion Lambda to production, you can upgrade without in
- You can have multiple functions with different versions deployed. Use the [`compatibleOnly`](/docs/lambda/getfunctions#compatibleonly) parameter to find functions that match the version of the `@remotion/lambda` package.
- Sites/`serveUrl`'s also are version-dependant. Create them with the same version of Remotion that you render them with. Remotion will tolerate mismatches if there are no incompatibilities, but will issue a warning that you might not have all the newest features and bugfixes in the bundled site.
+
+See also: [Separating production and testing environments](/docs/lambda/separate-environments)
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index f83561bbb2..b2d8b5fd5b 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -991,6 +991,7 @@ const sidebars: SidebarsConfig = {
'lambda/faq',
'lambda/light-client',
'lambda/custom-layers',
+ 'lambda/separate-environments',
'lambda/custom-destination',
'lambda/checklist',
'lambda/webhooks',
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 2b70799142..33978124c3 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -2600,6 +2600,15 @@ export const articles = [
noAi: false,
slug: 'lambda/s3-public-access',
},
+ {
+ id: 'separate-environments',
+ title: 'Separating production and testing environments',
+ relativePath: 'docs/lambda/separate-environments.mdx',
+ compId: 'articles-docs-lambda-separate-environments',
+ crumb: null,
+ noAi: false,
+ slug: 'lambda/separate-environments',
+ },
{
id: 'lambda/serverless-framework-integration',
title: 'Using the Serverless Framework with Remotion Lambda',
diff --git a/packages/docs/static/generated/articles-docs-lambda-separate-environments.png b/packages/docs/static/generated/articles-docs-lambda-separate-environments.png
new file mode 100644
index 0000000000..04cb2c7141
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-lambda-separate-environments.png differ