Skip to content

🎥 Make videos programmatically with React

New documentation: Remotion Lambda function naming convention

Jonny Burger9fae05eb315a
diff --git a/packages/docs/docs/lambda/naming-convention.mdx b/packages/docs/docs/lambda/naming-convention.mdx
new file mode 100644
index 0000000000..52671ad88d
--- /dev/null
+++ b/packages/docs/docs/lambda/naming-convention.mdx
@@ -0,0 +1,76 @@
+---
+image: /generated/articles-docs-lambda-naming-convention.png
+id: naming-convention
+title: Function naming convention
+slug: /lambda/naming-convention
+crumb: "Lambda"
+---
+
+A Remotion Lambda function has the following naming convention:
+
+```
+remotion-render-4-0-140-mem2048mb-disk2048mb-240sec
+ ^^^^^^^ ^^^^ ^^^^ ^^^
+ | | | |-- Timeout in seconds
+ | | |--------- Disk size in MB
+ | |------------------- Memory size in MB
+ |----------------------------- Remotion version with dots replaced by dashes
+```
+
+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.
+<br />
+<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 the renderer functions.
+
+## See also
+
+- [`speculateFunctionName()`](/docs/lambda/speculatefunctionname)
diff --git a/packages/docs/docs/lambda/speculateFunctionName.md b/packages/docs/docs/lambda/speculateFunctionName.md
index ece988235d..fffcd9db16 100644
--- a/packages/docs/docs/lambda/speculateFunctionName.md
+++ b/packages/docs/docs/lambda/speculateFunctionName.md
@@ -8,7 +8,7 @@ crumb: "Lambda API"
_available from v3.3.75_
-Speculate the name of the Lambda function that will be created by [deployFunction()](/docs/lambda/deployfunction) or its CLI equivalent, [`npx remotion lambda functions deploy`](/docs/lambda/cli/functions). This could be useful in cases when the configuration of the Lambda function is known in advance, and the name of the function is needed.
+Speculate the name of the Lambda function that will be created by [`deployFunction()`](/docs/lambda/deployfunction) or its CLI equivalent, [`npx remotion lambda functions deploy`](/docs/lambda/cli/functions). This could be useful in cases when the configuration of the Lambda function is known in advance, and the name of the function is needed.
If you are not sure whether a function exists, use [`getFunctionInfo()`](/docs/lambda/getfunctioninfo) and catch the error that gets thrown if it does not exist.
@@ -16,16 +16,9 @@ If you want to get a list of deployed functions, use [`getFunctions()`](/docs/la
## Function name pattern
-The function name depends on the following parameters:
+A Remotion Lambda function is always names like this:
-- Remotion version
-- Memory size
-- Disk size
-- Timeout
-
-The name of the function resembles the following pattern:
-
-```
+```txt
remotion-render-3-3-63-mem2048mb-disk2048mb-240sec
^^^^^^ ^^^^ ^^^ ^^^
| | | |-- Timeout in seconds
@@ -34,6 +27,8 @@ remotion-render-3-3-63-mem2048mb-disk2048mb-240sec
|----------------------------- Remotion version with dots replaced by dashes
```
+[Learn more](/docs/lambda/naming-convention) about this convention.
+
## Example
```ts twoslash
diff --git a/packages/docs/docs/miscellaneous/snippets/align-duration.mdx b/packages/docs/docs/miscellaneous/snippets/align-duration.mdx
index 1f5ef259f2..849e4085b9 100644
--- a/packages/docs/docs/miscellaneous/snippets/align-duration.mdx
+++ b/packages/docs/docs/miscellaneous/snippets/align-duration.mdx
@@ -1,4 +1,5 @@
---
+image: /generated/articles-docs-miscellaneous-snippets-align-duration.png
title: How do I make the composition the same duration as my video?
sidebar_label: Same composition duration as video
crumb: "FAQ"
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index f50f284728..d371eaa780 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -712,6 +712,7 @@ module.exports = {
"lambda/upgrading",
"lambda/uninstall",
"lambda/s3-public-access",
+ "lambda/naming-convention",
],
},
{
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index e070f17c2a..c2af5ca715 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -1266,6 +1266,13 @@ export const articles = [
compId: "articles-docs-lambda-multiple-buckets",
crumb: "@remotion/lambda",
},
+ {
+ id: "naming-convention",
+ title: "Function naming convention",
+ relativePath: "docs/lambda/naming-convention.mdx",
+ compId: "articles-docs-lambda-naming-convention",
+ crumb: "Lambda",
+ },
{
id: "lambda/permissions",
title: "Permissions",
@@ -1700,6 +1707,13 @@ export const articles = [
compId: "articles-docs-miscellaneous-snippets-adding-animations",
crumb: "Snippets",
},
+ {
+ id: "miscellaneous/snippets/align-duration",
+ title: "How do I make the composition the same duration as my video?",
+ relativePath: "docs/miscellaneous/snippets/align-duration.mdx",
+ compId: "articles-docs-miscellaneous-snippets-align-duration",
+ crumb: "FAQ",
+ },
{
id: "miscellaneous/snippets/combine-compositions",
title: "How do I combine compositions?",
diff --git a/packages/docs/static/generated/articles-docs-lambda-naming-convention.png b/packages/docs/static/generated/articles-docs-lambda-naming-convention.png
new file mode 100644
index 0000000000..80f271986f
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-lambda-naming-convention.png differ
diff --git a/packages/docs/static/generated/articles-docs-miscellaneous-snippets-align-duration.png b/packages/docs/static/generated/articles-docs-miscellaneous-snippets-align-duration.png
new file mode 100644
index 0000000000..dcccff0462
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-miscellaneous-snippets-align-duration.png differ