🎥 Make videos programmatically with React
document more APIs
Jonny Burger49d2cb621548
diff --git a/packages/docs/docs/lambda/faq.md b/packages/docs/docs/lambda/faq.mdindex 0c1198d801..f581824a88 100644--- a/packages/docs/docs/lambda/faq.md+++ b/packages/docs/docs/lambda/faq.md@@ -24,7 +24,7 @@ There are three exceptions when it is possible to deploy multiple functions:### Do I need to create multiple buckets?-Only one bucket per region is required.+Only [one bucket per region is recommended](/docs/lambda/multiple-buckets).### Do I need to deploy multiple sites?diff --git a/packages/docs/docs/lambda/getsites.md b/packages/docs/docs/lambda/getsites.mdindex 488e3f4c35..59a4d50dab 100644--- a/packages/docs/docs/lambda/getsites.md+++ b/packages/docs/docs/lambda/getsites.md@@ -81,7 +81,7 @@ URL of the deployed site. You can pass it into [`renderMediaOnLambda()`](/docs/lAn array of all buckets in the selected region in your account that start with `remotionlambda-`.:::info-You should only have 1 bucket for all your Remotion projects. Nonetheless `buckets` is an array, since we cannot prevent you from manually creating additional buckets with the `remotionlambda-` prefix.+You should only have [1 bucket](/docs/lambda/multiple-buckets) for all your Remotion projects. Nonetheless `buckets` is an array, since we cannot prevent you from manually creating additional buckets with the `remotionlambda-` prefix.:::Each item contains the following properties:diff --git a/packages/docs/docs/lambda/multiple-buckets.md b/packages/docs/docs/lambda/multiple-buckets.mdnew file mode 100644index 0000000000..c36d91e122--- /dev/null+++ b/packages/docs/docs/lambda/multiple-buckets.md@@ -0,0 +1,55 @@+---+image: /generated/articles-docs-lambda-multiple-buckets.png+title: Multiple buckets in Remotion Lambda+slug: /lambda/multiple-buckets+sidebar_label: Multiple buckets+crumb: "@remotion/lambda"+---++The ideal setup is if you use **1 bucket per region and account** that your use Remotion Lambda in.++While it is discouraged, it is possible to use multiple buckets from version v3.3.42 on.++## Reasons for 1 bucket++It is not necessary to create multiple buckets because:++- An S3 bucket is an effectively infinitely scalable storage solution.+- Remotion will perfectly isolate each render so they do not interfere with another.+- You can give sites a unique identifier to separate production and development environments.+- The Remotion Lambda function is a binary that does not change with your codebase.++You might intuitively create multiple buckets because you have multiple environments, but it is usually not needed.++## Using multiple buckets++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()`](/docs/lambda/getorcreatebucket) to create them.++Remotion will by default discover buckets automatically and re-use them. If it detects multiple buckets, it will throw an error.++In order to avoid this error, you need to additionally explicitly pass the `bucketName` option to the following APIs:++- [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda)+- [`getCompositionsOnLambda()`](/docs/lambda/getcompositionsonlambda)+- [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda)++Also you must pass a `--bucket-name=your-bucket-name` option to the following CLI commands:++- [`npx remotion lambda render`](/docs/lambda/cli/render)+- [`npx remotion lambda still`](/docs/lambda/cli/render)+- [`npx remotion lambda compositions`](/docs/lambda/cli/render)+- [`npx remotion lambda sites create`](/docs/lambda/cli/sites#create)++Also you are unable to use the following APIs:++- [`npx remotion lambda sites rm`]++## 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-".+```++but you were not intending to use multiple buckets, delete the extraneous buckets in the AWS console to fix the error.diff --git a/packages/docs/docs/lambda/sqs.md b/packages/docs/docs/lambda/sqs.mdindex 464ae126d3..e29b2b3727 100644--- a/packages/docs/docs/lambda/sqs.md+++ b/packages/docs/docs/lambda/sqs.md@@ -1,5 +1,5 @@----image: /generated/articles-docs-lambda-aws-sqs-lambda-integration.png+image: /generated/articles-docs-lambda-sqs.pngtitle: Using Lambda with SQSslug: /lambda/sqssidebar_label: Queueing with SQSdiff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex aac7cdbcd6..a59b22d420 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -429,6 +429,7 @@ module.exports = {},"lambda/serverless-framework-integration","lambda/sqs",+ "lambda/multiple-buckets","lambda/optimizing-cost","lambda/optimizing-speed","lambda/limits",diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex d153a62386..0cbb225a6c 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -482,13 +482,6 @@ export const articles = [compId: "articles-docs-lambda-authentication",crumb: "Lambda",},- {- id: "lambda/aws-sqs-lambda-integration",- title: "Using Lambda with SQS",- relativePath: "docs/lambda/aws-sqs-lambda-integration.md",- compId: "articles-docs-lambda-aws-sqs-lambda-integration",- crumb: "@remotion/lambda",- },{id: "changelog",title: "Prerelease Changelog",@@ -755,6 +748,13 @@ export const articles = [compId: "articles-docs-lambda-limits",crumb: "Lambda",},+ {+ id: "lambda/multiple-buckets",+ title: "Multiple buckets in Remotion Lambda",+ relativePath: "docs/lambda/multiple-buckets.md",+ compId: "articles-docs-lambda-multiple-buckets",+ crumb: "@remotion/lambda",+ },{id: "lambda/permissions",title: "Permissions",@@ -832,6 +832,13 @@ export const articles = [compId: "articles-docs-lambda-speed",crumb: "Lambda",},+ {+ id: "lambda/sqs",+ title: "Using Lambda with SQS",+ relativePath: "docs/lambda/sqs.md",+ compId: "articles-docs-lambda-sqs",+ crumb: "@remotion/lambda",+ },{id: "bucket-disallows-acl",title: "The bucket does not allow ACLs",diff --git a/packages/docs/static/generated/articles-docs-lambda-multiple-buckets.png b/packages/docs/static/generated/articles-docs-lambda-multiple-buckets.pngnew file mode 100644index 0000000000..cabb730e2bBinary files /dev/null and b/packages/docs/static/generated/articles-docs-lambda-multiple-buckets.png differdiff --git a/packages/docs/static/generated/articles-docs-lambda-sqs.png b/packages/docs/static/generated/articles-docs-lambda-sqs.pngnew file mode 100644index 0000000000..68429e5a2bBinary files /dev/null and b/packages/docs/static/generated/articles-docs-lambda-sqs.png differdiff --git a/packages/lambda/src/api/get-or-create-bucket.ts b/packages/lambda/src/api/get-or-create-bucket.tsindex 39ff9f2e52..8fd5031bba 100644--- a/packages/lambda/src/api/get-or-create-bucket.ts+++ b/packages/lambda/src/api/get-or-create-bucket.ts@@ -28,7 +28,7 @@ export const getOrCreateBucket = async ((b) => b.name)}) in your S3 region (${options.region- }) starting with "${REMOTION_BUCKET_PREFIX}". This is an error, please delete buckets so that you have one maximum.`+ }) starting with "${REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);}diff --git a/packages/lambda/src/api/get-sites.ts b/packages/lambda/src/api/get-sites.tsindex 407cbf3a04..989f883b1d 100644--- a/packages/lambda/src/api/get-sites.ts+++ b/packages/lambda/src/api/get-sites.ts@@ -16,6 +16,7 @@ type Site = {export type GetSitesInput = {region: AwsRegion;+ bucketName?: string;};export type GetSitesOutput = {@@ -33,7 +34,9 @@ export type GetSitesOutput = {export const getSites = async ({region,}: GetSitesInput): Promise<GetSitesOutput> => {- const {remotionBuckets} = await getRemotionS3Buckets(region);+ const remotionBuckets = await getRemotionS3Buckets(region).then(+ (b) => b.remotionBuckets+ );const accountId = await getAccountId({region});const sites: {[key: string]: Site} = {};diff --git a/packages/lambda/src/cli/commands/compositions/index.ts b/packages/lambda/src/cli/commands/compositions/index.tsindex 735db13bfc..8ae90ab49a 100644--- a/packages/lambda/src/cli/commands/compositions/index.ts+++ b/packages/lambda/src/cli/commands/compositions/index.ts@@ -2,6 +2,7 @@ import {CliInternals} from '@remotion/cli';import {getCompositionsOnLambda} from '../../..';import {BINARY_NAME} from '../../../shared/constants';import {validateServeUrl} from '../../../shared/validate-serveurl';+import {parsedLambdaCli} from '../../args';import {getAwsRegion} from '../../get-aws-region';import {findFunctionName} from '../../helpers/find-function-name';import {quit} from '../../helpers/quit';@@ -50,6 +51,7 @@ export const compositionsCommand = async (envVariables,logLevel,timeoutInMilliseconds: puppeteerTimeout,+ bucketName: parsedLambdaCli['bucket-name'],});CliInternals.printCompositions(comps);diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.tsindex d7b49ea09b..37f3c53949 100644--- a/packages/lambda/src/cli/commands/render/render.ts+++ b/packages/lambda/src/cli/commands/render/render.ts@@ -134,6 +134,7 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {}: undefined,rendererFunctionName: parsedLambdaCli['renderer-function-name'] ?? null,+ bucketName: parsedLambdaCli['bucket-name'],audioCodec: CliInternals.parsedCli['audio-codec'],});