Skip to main content

启用 Lambda Insightsv4.0.61

🌐 Enable Lambda Insightsv4.0.61

你可以为你的 Remotion Lambda 函数启用 AWS Lambda Insights

🌐 You may enable AWS Lambda Insights for your Remotion Lambda function.

先决条件

🌐 Prerequisites

确保你使用的是至少 Remotion v4.0.61 版本。
2
如果你在 v4.0.61 之前就开始使用 Remotion,请更新你的 AWS 用户权限AWS 角色权限,因为现在需要更多权限。

启用 Lambda Insights

🌐 Enable Lambda Insights

通过 CLI:

npx remotion lambda functions deploy --enable-lambda-insights

如果该函数之前已经存在,你需要事先将其删除。

🌐 If the function already existed before, you need to delete it beforehand.

通过 Node.js API:

deploy.ts
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);

为 Lambda 函数添加角色

🌐 Add a role to the Lambda function

为了真正允许 Lambda 向 CloudWatch 发送数据,你需要执行一次此操作:

🌐 In order to actually allow Lambda to send data to CloudWatch, you need to do this once:

  • 前往 Lambda 仪表板并选择任意 Remotion Lambda 函数。
  • 在“配置”选项卡中,向下滚动到“监控和操作工具”,在“附加监控工具”部分,点击“编辑”。
  • 切换开关以“启用 AWS Lambda Insights”。如果它已经开启,请先禁用,保存,然后再重新启用。

这将为 Lambda 函数的角色添加必要的权限。
在默认设置下,所有 Lambda 函数共享相同的角色,因此你只需要执行一次即可。

🌐 This will add the necessary permissions to the role of the Lambda function.
All Lambda functions share the same role with the default setup, so you only need to do this once.

查看 Lambda 见解

🌐 View Lambda insights

在你的 CloudWatch 仪表板(us-east-1 的链接)中,导航至 Insights ➞ Lambda Insights ➞ 单个函数,你可以查看 Remotion Lambda 函数的指标。

🌐 In your CloudWatch dashboard (link for us-east-1) under Insights ➞ Lambda Insights ➞ Single function, you can view the metrics of the Remotion Lambda function.

Lambda Insights 的链接也包含在 renderMediaOnLambda() 的返回值中。

🌐 A link to the Lambda insights is also included in the return value of renderMediaOnLambda().

如果你通过命令行使用 --log=verbose 标志进行渲染,无论是否启用了 Lambda insights,都会打印指向 Lambda insights 的链接。

🌐 If you render via the CLI with the --log=verbose flag, a link to the Lambda insights is also printed, regardless of if Lambda insights are enabled or not.

不支持的地区

🌐 Unsupported regions

Lambda Insights 在 ap-southeast-4ap-southeast-5eu-central-2 上不受 AWS 支持。
如果你在这些区域之一部署 Lambda 函数并尝试启用 Lambda Insight,将会抛出错误。

🌐 Lambda Insights is not supported by AWS in ap-southeast-4 and ap-southeast-5 and eu-central-2.
If you deploy a Lambda function in one of these regions and attempt to enable Lambda Insight, an error will be thrown.

另请参阅

🌐 See also