Skip to main content

Remotion Lambda 中的多个桶

理想的设置是,如果你在使用 Remotion Lambda 的每个区域和账户中使用 1 个桶

🌐 The ideal setup is if you use 1 bucket per region and account that you use Remotion Lambda in.

虽然不鼓励,但从 v3.3.42 版本开始可以使用多个存储桶。

🌐 While it is discouraged, it is possible to use multiple buckets from version v3.3.42 on.

1个桶的原因

🌐 Reasons for 1 bucket

没有必要创建多个存储桶,因为:

🌐 It is not necessary to create multiple buckets because:

  • S3 存储桶是一种几乎无限可扩展的存储解决方案。
  • Remotion 将完美隔离每个渲染,以防它们互相干扰。
  • 你可以为网站提供唯一标识符,以区分生产环境和开发环境。
  • Remotion Lambda 函数是一个二进制文件,不会随你的代码库而改变。

你可能会直觉上创建多个桶,因为你有多个环境,但通常不需要。

🌐 You might intuitively create multiple buckets because you have multiple environments, but it is usually not needed.

除此之外,Remotion 并不是为多个存储桶设计的。虽然你可以明确指定存储桶名称,但这是可选的,因此很容易被忘记。

🌐 In addition to that, Remotion was not designed for multiple buckets. While you can explicitly specify a bucket name, it is optional and therefore easy to forget.

使用多个桶

🌐 Using multiple buckets

如果你仍然想使用多个存储桶(对它们应用不同的策略或满足业务或合规要求),你可以在 AWS 控制台中创建更多存储桶。不要使用 getOrCreateBucket() 来创建它们。

🌐 If you want to use multiple buckets nonetheless (applying different policies to them or fulfilling business or compliance requirements), you can create more buckets in the AWS console. Don't use getOrCreateBucket() to create them.

Remotion 默认会自动发现存储桶并重新使用它们。如果它检测到多个存储桶,它将抛出错误。

🌐 Remotion will by default discover buckets automatically and re-use them. If it detects multiple buckets, it will throw an error.

为了避免此错误,你还需要显式地将 forceBucketName 选项传递给以下 API:

🌐 In order to avoid this error, you need to additionally explicitly pass the forceBucketName option to the following APIs:

此外,你必须向以下 CLI 命令传递一个 --force-bucket-name=your-bucket-name 选项:

🌐 Also you must pass a --force-bucket-name=your-bucket-name option to the following CLI commands:

此外,你无法使用以下 APIs:

🌐 Also you are unable to use the following APIs:

删除多余的桶

🌐 Deleting extraneous buckets

如果你收到错误信息

🌐 If you got an error message

You have multiple buckets [a,b,c] in your S3 region [us-east-1] starting with "remotionlambda-".

但如果你不打算使用多个存储桶,请在 AWS 控制台中删除多余的存储桶以修复错误。

🌐 but you were not intending to use multiple buckets, delete the extraneous buckets in the AWS console to fix the error.

另请参阅

🌐 See also