Your complete guide to deploying Remotion Lambda on AWS for scalable, on-demand video generation. Learn AWS setup, function deployment, API integration, cost optimization, and monitoring strategies.
Configure your AWS environment with the proper permissions and credentials to deploy Remotion Lambda functions.
Remotion Lambda requires specific IAM permissions for Lambda, S3, and CloudWatch. Use the built-in policy generator to create the exact permissions needed.
Add the Lambda package to your project with npm install @remotion/lambda. This provides both CLI commands and the Node.js API for programmatic rendering.
Run npx remotion lambda policies user to output the required IAM policy JSON. Create a dedicated IAM user and attach this policy for secure, scoped access.
Set your AWS credentials via environment variables: REMOTION_AWS_ACCESS_KEY_ID, REMOTION_AWS_SECRET_ACCESS_KEY, and REMOTION_AWS_REGION.
Choose an AWS region close to your users for faster video delivery. Lambda is available in most regions, but us-east-1 offers the most capacity.
Before deploying, ensure you have all requirements in place for a smooth setup process.
Deploy your Remotion rendering function and upload your project to S3 for serverless video generation.
Run npx remotion lambda functions deploy to create the Lambda function with the Remotion runtime. Note the function name returned—you'll need it for rendering.
Customize your function with deployment flags: --memory=2048 for RAM allocation, --timeout=240 for max duration, and --disk=2048 for temp storage.
Upload your Remotion project to S3 with npx remotion lambda sites create src/index.ts --site-name=my-video-site. This bundles and hosts your compositions for Lambda access.
Use meaningful site names for version control. Deploy staging and production sites separately to safely test changes before going live.
List your deployed functions with npx remotion lambda functions ls. Confirm the function name, memory allocation, and timeout match your requirements.
When updating your project, redeploy the site with the same name. For Remotion version upgrades, also redeploy the function with npx remotion lambda functions deploy.
Integrate Lambda rendering into your applications using the Node.js API for programmatic video generation.
Use renderMediaOnLambda() from @remotion/lambda/client to start renders programmatically. Pass your function name, serve URL, composition ID, and input props.
Every render requires these core parameters for successful execution.
region: AWS region (e.g., 'us-east-1')functionName: Your deployed function nameserveUrl: S3 URL from site deploymentcomposition: Composition ID to renderinputProps: Dynamic data for the videoCall renderMediaOnLambda() with your configuration. It returns a renderId and bucketName for tracking progress and retrieving the output.
Poll getRenderProgress() with the render ID to check status. The response includes overallProgress (0-1), done flag, and outputFile URL when complete.
Customize your render output with codec, quality, and privacy settings: codec: 'h264', jpegQuality: 80, privacy: 'public'.
Implement a polling loop that starts the render, checks progress every second, and returns the output URL when done. Handle fatalErrorEncountered for error cases.
Minimize AWS costs while maintaining render performance with these optimization techniques.
Lambda pricing scales with memory allocation. Start with 1024MB and increase only if renders are slow. More memory also means more CPU, so find the sweet spot.
Choose memory based on your composition complexity.
| Complexity | Memory | Use Case |
|---|---|---|
| Simple | 1024MB | Text animations, basic graphics |
| Medium | 2048MB | Images, moderate effects |
| Complex | 3008MB | Video overlays, heavy processing |
Set imageFormat: 'jpeg' instead of PNG when transparency isn't needed. JPEG frames are smaller and faster to process, reducing both time and cost.
Reduce render costs by optimizing your Remotion compositions.
S3 storage costs accumulate over time. Use npx remotion lambda renders rm <render-id> to delete old renders, or set up S3 lifecycle policies for automatic cleanup.
Group renders with similar configurations to maximize Lambda warm starts. Warm functions start faster and cost less than cold starts.
Monitor your Lambda renders, debug issues, and implement production-ready error handling.
Lambda automatically logs to CloudWatch. View logs in the AWS Console or use npx remotion lambda functions ls to see function status and recent activity.
Run npx remotion lambda renders ls to view recent render jobs. This shows render IDs, status, duration, and output locations for troubleshooting.
Check progress.fatalErrorEncountered in your polling loop. When true, progress.errors contains error details. Implement retry logic with maxRetries parameter.
Create CloudWatch alarms for Lambda errors and duration. Get notified when renders fail or take longer than expected, enabling quick response to issues.
Follow these practices for reliable production deployments.
When a render fails, check the error message in progress.errors. Common issues include missing assets, invalid props, or timeout exceeded. CloudWatch logs provide detailed stack traces.
Continue exploring with these related guides and tutorials.



Now that you understand Lambda deployment, explore our template library to find compositions ready for serverless rendering at scale.