Skip to content

🎥 Make videos programmatically with React

add a doc page

Jonny Burger6f6b6b22190f
diff --git a/packages/docs/docs/lambda/cli/functions.md b/packages/docs/docs/lambda/cli/functions.md
index 77c58a63e5..5990eb9f8a 100644
--- a/packages/docs/docs/lambda/cli/functions.md
+++ b/packages/docs/docs/lambda/cli/functions.md
@@ -78,9 +78,9 @@ Does not create a CloudWatch log group.
Retention period for the CloudWatch Logs in days. Default: <DefaultLogRetention /> days.
-### `--enable-lambda-insights`
+### `--enable-lambda-insights`<AvailableFrom v="4.0.61" />
-Enable AWS Lambda Insights for the lambda function
+<Options id="enable-lambda-insights" />
### `--custom-role-arn`
diff --git a/packages/docs/docs/lambda/deployfunction.md b/packages/docs/docs/lambda/deployfunction.md
index ce7792459c..16d372240b 100644
--- a/packages/docs/docs/lambda/deployfunction.md
+++ b/packages/docs/docs/lambda/deployfunction.md
@@ -69,11 +69,9 @@ _optional_
Use a custom role for the function instead of the default (`arn:aws:iam::[aws-account-id]:role/remotion-lambda-role`)
-### `enableLambdaInsights`
+### `enableLambdaInsights`<AvailableFrom v="4.0.61" />
-_optional_
-
-Whether to enable AWS Lambda Insights for the function. Lambda Insights is a tool that provides visibility into the performance and behavior of Lambda functions. If set to true, it will enable the collection of additional metrics and logs for the function.
+<Options id="enable-lambda-insights" />
## Return value
diff --git a/packages/docs/docs/lambda/insights.md b/packages/docs/docs/lambda/insights.md
new file mode 100644
index 0000000000..95d4483e72
--- /dev/null
+++ b/packages/docs/docs/lambda/insights.md
@@ -0,0 +1,46 @@
+---
+sidebar_label: Insights
+title: Enable Lambda Insights
+crumb: "Lambda"
+---
+
+# Enable Lambda insights<AvailableFrom v="4.0.61"/>
+
+You may enable [AWS Lambda Insights](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights.html) for your Remotion Lambda function.
+
+## Prerequisites
+
+<Step>1</Step> Ensure you are on at least Remotion v4.0.61. <br/>
+<Step>2</Step> If you started using Remotion before v4.0.61, update both your <a href="/docs/lambda/permissions#user-permissions">AWS user permission</a> and <a href="/docs/lambda/permissions#role-permissions">AWS role permission</a>, since now more permissions are needed.
+
+## Enable Lambda insights
+
+**Via CLI**:
+
+```
+npx remotion lambda functions deploy --enable-lambda-insights
+```
+
+If the function already existed before, you need to delete it beforehand.
+
+**Via Node.js APIs:**
+
+```tsx twoslash title="deploy.ts" {8, 11-13}
+// @module: ESNext
+// @target: ESNext
+import assert from "assert";
+// ---cut---
+import { deployFunction } from "@remotion/lambda";
+
+const { alreadyExisted } = await deployFunction({
+ createCloudWatchLogGroup: true,
+ region: "us-east-1",
+ timeoutInSeconds: 120,
+ memorySizeInMb: 3009,
+ enableLambdaInsights: true,
+});
+
+// Note: If the function previously already existed, Lambda insights are not applied.
+// Delete the old function and deploy again.
+assert(!alreadyExisted);
+```
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 609940d813..5d067df465 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -611,6 +611,7 @@ module.exports = {
"lambda/python",
"lambda/serverless-framework-integration",
"lambda/sqs",
+ "lambda/insights",
"lambda/multiple-buckets",
"lambda/bucket-naming",
"lambda/optimizing-cost",
@@ -619,7 +620,6 @@ module.exports = {
"lambda/changelog",
"lambda/upgrading",
"lambda/uninstall",
- "lambda/feb-2023-incident",
"lambda/s3-public-access",
],
},
diff --git a/packages/renderer/src/options/enable-lambda-insights.tsx b/packages/renderer/src/options/enable-lambda-insights.tsx
new file mode 100644
index 0000000000..372843eddf
--- /dev/null
+++ b/packages/renderer/src/options/enable-lambda-insights.tsx
@@ -0,0 +1,18 @@
+import type {AnyRemotionOption} from './option';
+
+export const enableLambdaInsights = {
+ name: 'Enable Lambda insights',
+ cliFlag: 'enable-lambda-insights',
+ description: () => (
+ <>
+ Enable{' '}
+ <a href="https://remotion.dev/docs/lambda/insights">
+ Lambda Insights in AWS CloudWatch
+ </a>
+ . For this to work, you may have to update your role permission.
+ </>
+ ),
+ ssrName: 'enableLambdaInsights',
+ docLink: 'https://www.remotion.dev/docs/lambda/insights',
+ type: false as boolean,
+} satisfies AnyRemotionOption;
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index af08011d93..7b791e88ab 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -2,6 +2,7 @@ import {audioBitrateOption} from './audio-bitrate';
import {colorSpaceOption} from './color-space';
import {crfOption} from './crf';
import {deleteAfterOption} from './delete-after';
+import {enableLambdaInsights} from './enable-lambda-insights';
import {enableMultiprocessOnLinuxOption} from './enable-multiprocess-on-linux';
import {enforceAudioOption} from './enforce-audio';
import {folderExpiryOption} from './folder-expiry';
@@ -30,4 +31,5 @@ export const allOptions = {
folderExpiryOption,
enableMultiprocessOnLinuxOption,
glOption,
+ enableLambdaInsights,
};