Lambda Resources
The Lambda function configuration is defined inconfig.mjs. These settings determine the resources allocated to your rendering functions.
Region
The AWS region where your Lambda functions and S3 bucket will be deployed.Choose a region based on:
- Geographic proximity to your users
- Cost differences between regions
- Available AWS services and features
us-east-1- US East (N. Virginia)us-west-2- US West (Oregon)eu-west-1- Europe (Ireland)ap-southeast-1- Asia Pacific (Singapore)
Memory (RAM)
Memory allocated to Lambda function in megabytes (MB).Guidelines:
- Minimum: 2048 MB for basic video rendering
- Recommended: 3009 MB for most use cases
- High complexity: 4096+ MB for 4K or effects-heavy videos
Higher RAM also increases CPU allocation proportionally. More RAM = faster rendering but higher cost.
Disk Space
Ephemeral disk storage for Lambda function in megabytes (MB).Guidelines:
- Default: 10240 MB (10 GB) handles most renders
- Increase if rendering:
- Very long videos (>5 minutes)
- High-resolution output (4K)
- Videos with large asset files
Timeout
Maximum execution time for Lambda function in seconds.Guidelines:
- Default: 240 seconds (4 minutes)
- Short videos (under 30s): 120 seconds may suffice
- Long videos (over 2 min): Consider 300+ seconds
AWS Lambda has a hard limit of 900 seconds (15 minutes). Remotion’s distributed rendering splits work across multiple functions to handle longer videos.
Site Name
Identifier for your deployed Remotion site.This name is used to identify your deployed video template bundle. Change it if deploying multiple projects to the same AWS account.
Environment Variables
Environment variables are configured in your.env file. These are required for both deployment and rendering.
AWS Credentials
AWS Access Key ID for authenticating with AWS services.How to get:
- Log into AWS Console
- Navigate to IAM > Users > Security Credentials
- Create a new access key
AWS_ACCESS_KEY_ID (standard AWS SDK environment variable).AWS Secret Access Key paired with your Access Key ID.Security:
- Store securely (use environment variable management)
- Rotate regularly
- Never log or expose in client-side code
AWS_SECRET_ACCESS_KEY (standard AWS SDK environment variable).OpenAI Configuration
Your OpenAI API key for generating video content from text prompts.How to get:
- Sign up at platform.openai.com
- Navigate to API Keys
- Create a new secret key
Configuration Validation
The deployment script validates your configuration before deploying:Function Name Generation
The Lambda function name is automatically generated based on your configuration:config.mjs, you must redeploy using node deploy.mjs.
Render-Time Configuration
When rendering videos via the API, additional options are configured in the render endpoint:Codec
Frames Per Lambda
- Lower values (30-50): More parallelization, faster renders, higher cost
- Higher values (60-120): Less parallelization, slower renders, lower cost
- Video complexity (simpler = higher values)
- Budget constraints
- Time requirements
Download Behavior
type: "download": Video downloads when URL is accessedfileName: Name of the downloaded file
Optimization Strategies
Cost Optimization
- Reduce RAM if renders complete successfully with lower memory
- Increase framesPerLambda to reduce number of function invocations
- Choose cheaper regions (us-east-1 is typically least expensive)
- Set appropriate timeout - don’t over-allocate
Performance Optimization
- Increase RAM for faster CPU allocation and quicker renders
- Decrease framesPerLambda for more parallel processing
- Choose region close to users for faster upload/download
- Increase timeout if encountering timeout errors
Resource Planning
| Video Duration | Recommended RAM | Recommended Timeout | Frames Per Lambda |
|---|---|---|---|
| < 30 seconds | 2048 MB | 120 seconds | 90 |
| 30-60 seconds | 3009 MB | 240 seconds | 60 |
| 1-3 minutes | 3009 MB | 300 seconds | 60 |
| 3-5 minutes | 4096 MB | 300 seconds | 45 |
When to Update Configuration
You must redeploy (node deploy.mjs) when changing:
REGIONRAMDISKTIMEOUTSITE_NAME
- Environment variables (
.envfile) - Render-time options (codec, framesPerLambda)