Prerequisites
Before deploying to AWS Lambda, you need:- An AWS account with appropriate permissions
- AWS access credentials (Access Key ID and Secret Access Key)
- Node.js installed locally
Environment Variables
First, configure your AWS credentials in your.env file:
Your AWS Access Key ID. This is used to authenticate with AWS services.
Your AWS Secret Access Key. Keep this secure and never commit it to version control.
Your OpenAI API key for generating video content from prompts.
Deployment Process
The deployment script (deploy.mjs) handles the complete setup automatically:
Verify AWS Credentials
The script checks that your AWS credentials are properly configured:If credentials are missing, the deployment will exit with instructions to complete the Lambda setup.
Deploy Lambda Function
The script deploys a Lambda function with the configured resources:This creates or updates the Lambda function with:
- Memory: 3009 MB (configured in
config.mjs) - Timeout: 240 seconds (4 minutes)
- Disk: 10240 MB (10 GB)
- Region: us-east-1 (configurable)
- CloudWatch Logs: Automatically created for monitoring
Create or Get S3 Bucket
An S3 bucket is created to store rendered videos and deployment artifacts:The bucket is automatically named and configured for the specified region.
Running the Deployment
Execute the deployment script:When to Re-deploy
Re-run the deployment command when you:- Changed the video template or composition
- Modified
config.mjssettings - Upgraded Remotion to a newer version
The deployment script is idempotent - it will update existing resources rather than creating duplicates.
Next Steps
Once deployed, you can:Troubleshooting
Missing Credentials
If you see an error about missing credentials, ensure your.env file contains:
Permission Errors
Your AWS IAM user needs permissions for:- Lambda (create/update functions)
- S3 (create buckets, upload objects)
- CloudWatch Logs (create log groups)
- IAM (create roles for Lambda execution)