Using Remotion Lambda with R2
R2 by Cloudflare is a popular way to store renders because there are no egress fees.
Create a Cloudflare bucket and set up an API key with Object Read & Write permissions.
Use an s3OutputProvider
to store the rendered video in R2:
tsx
const {bucketName ,renderId ,cloudWatchMainLogs } = awaitrenderMediaOnLambda ({serveUrl : 'https://remotion-helloworld.vercel.app',// FIXME: Add your function specs herefunctionName :speculateFunctionName ({diskSizeInMb : 2048,memorySizeInMb : 2048,timeoutInSeconds : 120,}),composition : 'HelloWorld',region : 'eu-central-1',codec : 'h264',outName : {// FIXME: Use the bucket name from your Cloudflare Storage settingsbucketName : 'remotion-test-bucket',key : 'out.mp4',s3OutputProvider : {// FIXME: Use the endpoint from your Cloudflare Storage settingsendpoint : 'https://2fe488b3b0f4deee223aef7464784c46.r2.cloudflarestorage.com',// FIXME: Use the Access Key from your Cloudflare settingsaccessKeyId :process .env .R2_ACCESS_KEY_ID ?? '',// FIXME: Use the Secret Access Key from your Cloudflare settingssecretAccessKey :process .env .R2_SECRET_ACCESS_KEY ?? '',},},});