Skip to main content

Custom Lambda function namesv4.0.540

While we recommend the default Lambda function names, the organization you work for might have naming conventions that you need to follow.

You can override the default function name to meet organizational naming requirements or deploy separate functions with the same configuration.

If you do so, there are a couple of extra steps you need to take.

Configure IAM permissions​

The user and role policies are scoped to the remotion-render- prefix by default.
Change them first so they apply to your function names.

Deploy with a custom name​

Pass functionName to deployFunction():

deploy.ts
import {deployFunction} from '@remotion/lambda'; const {functionName} = await deployFunction({ region: 'us-east-1', functionName: 'acme-render-production-4-0-542', memorySizeInMb: 2048, diskSizeInMb: 2048, timeoutInSeconds: 120, createCloudWatchLogGroup: true, }); console.log(functionName);

Or pass --function-name to the CLI:

Terminal
npx remotion lambda functions deploy --region=us-east-1 --function-name=acme-render-production-4-0-542

Names must contain 1–64 letters, digits, hyphens or underscores.

Deploying again with the same name, Remotion version, memory size, disk size and timeout reuses the existing function.

If those values differ, choose another name or delete the existing function before deploying.

Including the Remotion version in your custom name lets you deploy upgrades alongside functions still serving renders.

Select the function explicitly​

getFunctions() and remotion lambda functions ls only discover names starting with remotion-render-.

Pass your function name directly to renderMediaOnLambdaAndStream() to stream progress and wait for the render to finish:

render.ts
import {downloadMedia} from '@remotion/lambda'; import {renderMediaOnLambdaAndStream} from '@remotion/lambda/client'; const functionName = 'acme-render-production-4-0-542'; const result = await renderMediaOnLambdaAndStream({ region: 'us-east-1', functionName, serveUrl: 'https://example.com/my-remotion-site', composition: 'MyComposition', codec: 'h264', privacy: 'private', onProgress: ({overallProgress}) => { console.log(overallProgress); }, }); const {outputPath} = await downloadMedia({ region: 'us-east-1', renderId: result.renderId, bucketName: result.bucket, outPath: 'out.mp4', }); console.log(outputPath);

For CLI renders, use --function-name to pass the name explicitly:

Terminal
npx remotion lambda render https://example.com/my-remotion-site MyComposition --region=us-east-1 --function-name=acme-render-production-4-0-542

Use a separate renderer function​

You can give the main function and renderer workers different names and memory sizes. Deploy a second function with the same Remotion version in the same account and region:

deploy-renderer.ts
import {deployFunction} from '@remotion/lambda'; const {functionName: rendererFunctionName} = await deployFunction({ region: 'us-east-1', functionName: 'acme-render-worker-4-0-542', memorySizeInMb: 1536, diskSizeInMb: 2048, timeoutInSeconds: 120, createCloudWatchLogGroup: true, }); console.log(rendererFunctionName);

Pass this name as rendererFunctionName, and keep the main function's name in functionName:

render-with-workers.ts
import {renderMediaOnLambdaAndStream} from '@remotion/lambda/client'; const result = await renderMediaOnLambdaAndStream({ region: 'us-east-1', functionName: 'acme-render-production-4-0-542', rendererFunctionName: 'acme-render-worker-4-0-542', serveUrl: 'https://example.com/my-remotion-site', composition: 'MyComposition', codec: 'h264', privacy: 'private', onProgress: ({overallProgress}) => { console.log(overallProgress); }, }); console.log(result.outputFile);

See also​