deploySite()
Prefer building with bundle() and uploading its output with deploySiteFromBundle(). Separating these steps avoids rebuilding an unchanged bundle during deployment.
deploySite() remains available and continues to bundle a Remotion project and upload it to an S3 bucket. Once uploaded, a Lambda function can render any composition in the Remotion project by specifying the URL.
- If you make changes locally, you need to redeploy the site. You can use
siteNameto overwrite the previous site. - Note that the Remotion project will be deployed to a subdirectory, not the root of the domain. Therefore you must ensure that if you have specified paths in your Remotion project, they are able to handle this scenario.
- Before calling this function, you should create a bucket, see
getOrCreateBucket().
Example
import {deploySite } from '@remotion/lambda';
import path from 'path';
const {serveUrl } = await deploySite ({
entryPoint : path .resolve (process .cwd (), 'src/index.ts'),
bucketName : 'remotionlambda-c7fsl3d',
region : 'us-east-1',
options : {
onBundleProgress : (progress ) => {
// Progress is between 0 and 100
console .log (`Bundle progress: ${progress }%`);
},
onUploadProgress : ({totalFiles , filesUploaded , totalSize , sizeUploaded }) => {
console .log (`Upload progress: Total files ${totalFiles }, Files uploaded ${filesUploaded }, Total size ${totalSize }, Size uploaded ${sizeUploaded }`);
},
},
});
console .log (serveUrl );Arguments
An object with the following properties:
entryPoint
An absolute path pointing to the entry point of your Remotion project. Usually the entry point in your Remotion project is stored at src/index.ts.
bucketName
The bucket to where the website will be deployed. The bucket must have been created by Remotion Lambda.
region
The AWS region in which the bucket resides.
siteName?
Specify the subfolder in your S3 bucket that you want the site to deploy to. If you omit this property, a new subfolder with a random name will be created. If a site already exists with the name you passed, it will be overwritten. Can only contain the following characters: 0-9, a-z, A-Z, -, !, _, ., *, ', (, )
logLevel?v4.0.140
One of trace, verbose, info, warn, error.Determines how much info is being logged to the console.
Default
info.
options?
An object with the following properties:
onBundleProgress?
Callback from Webpack when the bundling has progressed. Passes a number between 0 and 100 to the callback, see example at the top of the page.
onUploadProgress?
Callback function that gets called when uploading of the assets has progressed. Passes an object with the following properties to the callback:
totalFiles
number
Total number of files in the bundle.
filesUploaded
number
Number of files that have been fully uploaded so far.
totalSize
number
Total size in bytes of all the files in the bundle.
sizeUploaded
number
Amount of bytes uploaded so far.
webpackOverride?
Passes a custom Webpack override. It is ignored if rspack is true. See bundle() → webpackOverride.
bundlerOverride?v4.0.498
Passes an override shared by Webpack and Rspack. See bundle() → bundlerOverride.
rspackOverride?v4.0.498
Passes a custom Rspack override. See bundle() → rspackOverride.
enableCaching?
Enable or disable Webpack caching. This flag is enabled by default, use --bundle-cache=false to disable caching.
publicDir?v3.2.17
Define the location of the public/ directory. If not defined, Remotion will assume the location is the public folder in your Remotion root.
rootDir?v3.2.17
The directory in which the Remotion project is rooted in. This should be set to the directory that contains the package.json which installs Remotion. By default, it is the current working directory.
The current working directory is the directory from which your program gets executed from. It is not the same as the file where bundle() gets called.
ignoreRegisterRootWarning?v3.3.55
Ignore an error that gets thrown if you pass an entry point file which does not contain registerRoot().
keyboardShortcutsEnabled?v4.0.407
Enable or disable keyboard shortcuts in the Remotion Studio.
askAIEnabled?v4.0.407
The Ask AI feature, opened with the Cmd + I shortcut, is enabled by default in the Studio. This option disables it, for example if the shortcut conflicts with your setup.
rspack?v4.0.426
Uses Rspack instead of Webpack as the bundler for the Studio or bundle.
privacy?v3.3.97
Either public (default) or no-acl if you are not using ACL. Sites must have a public URL to be able to be rendered on Lambda, since the headless browser opens that URL.
throwIfSiteExists?v4.0.141
Prevents accidental update of an existing site. If there are any files in the subfolder where the site should be placed, Remotion throws an error.
forcePathStyle?v4.0.202
Passes forcePathStyle to the AWS S3 client.
requestHandler?v4.0.315
A custom AWS SDK request handler, for example to use a proxy.
Return value
An object with the following values:
serveUrl
string
An URL such as https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.html.
You can use this "serve URL" to render a video on Remotion Lambda using:
- The
npx remotion lambda renderandnpx remotion lambda stillcommands - The
renderMediaOnLambda()andrenderStillOnLambda()functions. - Locally using the
renderMedia()andrenderStill()functions. - Locally using the
npx remotion renderandnpx remotion stillcommands
If you are rendering on Lambda, you can also pass the site name (in this case abcdef) as an abbreviation.
siteName
string
The identifier of the site that was given. Is either the site name that you have passed into this function, or a random string that was generated if you didn't pass a site name.
statsv3.3.7
An object with 3 entries:
uploadedFiles
number
The number of files that were uploaded.
deletedFiles
number
The number of files that were deleted.
untouchedFiles
number
The number of files that already existed and were left untouched.
Changelog
From v3.3.7, this function is incremental: It only compares the contents of the local files and the files on S3 and only executes the necessary operations.
Compatibility
| Servers | Environments | |||||
|---|---|---|---|---|---|---|
Node.js | Bun | Serverless Functions | ||||