packages/docs/docs/lambda/getsites.mdx
Gets an array of Remotion projects in your S3 account.
The projects are located in the sites/ subdirectory of your S3 bucket. Remember - you should only have one bucket for Remotion Lambda per region, therefore you do not need to specify the name of the bucket for this function.
Gets all sites and logs information about them.
import {getSites} from '@remotion/lambda/client';
const {sites, buckets} = await getSites({
region: 'eu-central-1',
});
for (const site of sites) {
console.log(site.id); // A unique ID for referring to that project
console.log(site.bucketName); // In which bucket the site resides in.
console.log(site.lastModified); // A unix timestamp, but may also be null
console.log(site.sizeInBytes); // Size of all contents in the folder
console.log(site.serveUrl); // URL of the deployed site that you can pass to `renderMediaOnLambda()`
console.log(site.version); // The Remotion version of the site, or null
}
for (const bucket of buckets) {
console.log(bucket.region); // 'eu-central-1'
console.log(bucket.name); // The name of the S3 bucket.
console.log(bucket.creationDate); // A unix timestamp of when the site was created.
}
:::note
Preferrably import this function from @remotion/lambda/client (available from v3.3.42) to avoid problems inside serverless functions.
:::
An object with the following properties:
regionThe AWS region which you want to query.
forceBucketName?<AvailableFrom v="3.3.102"/>Specify a specific bucket name to be used. This is not recommended, instead let Remotion discover the right bucket automatically.
compatibleOnly?<AvailableFrom v="4.0.435"/>If true, only sites whose Remotion version matches the installed version of @remotion/lambda are returned. If false or not provided, all sites are returned.
A promise resolving to an object with the following properties:
sitesAn array of deployed Remotion projects that you can use for rendering.
Each item contains the following properties:
idA unique identifier for that project.
bucketNameThe bucket in which the project resides in.
lastModifiedWhen the files in that project were last changed.
sizeInBytesThe combined size of all files in that project.
serveUrlURL of the deployed site. You can pass it into renderMediaOnLambda() to render a video or audio.
version<AvailableFrom v="4.0.435"/>The Remotion version of the site, or null if the version could not be determined.
bucketsAn array of all buckets in the selected region in your account that start with remotionlambda-.
:::info
You should only have 1 bucket per region 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:
regionThe region the bucket resides in.
nameThe name of the bucket. S3 buckets have globally unique names.
creationDateA UNIX timestamp of the point when the bucket was first created.