Using the GPU in the cloud
Here is an example workflow for how to use the GPU in the cloud to render your videos using EC2 instances.
Update Remotion
Ensure you are using Remotion v4.0.248 or later for this guide to work.
Launch an EC2 instance
You might need to ask AWS for a limit increase for the number of GPUs you can use.
You can do this in the AWS console.
Go to "Service Quotas" -> "AWS Services" -> "Amazon Elastic Compute Cloud (Amazon EC2)" -> "Running On-Demand G and VT instances" -> "Request increase at account-level".
You may also click here to go to the page directly for the us-east-1 region.
Click here to launch an EC2 instance on us-east-1.
Select "Browse more AMIs", search for ami-06a1f46caddb5669e, select the "Community AMIs" tab and select the image with the right AMI (ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-20230608).
It might take up to 30 seconds until the search finds the AMI and it is not the first result.
We recommend the g4dn.xlarge size - note that this instance costs $375 per month with the default configuration.
If you get a message "Subscribing to AMI is taking longer than expected", it is normal. You may need to wait a few minutes.
Once you connected to the instance, run the following commands:
Upgrade the Linux Kernel to v6bash
The instance will restart and therefore disconnect. Wait a few moments and then reconnect.
Install the Linux Dependencies for Remotion:
Install Linux Dependenciesbash
Set up GPU drivers:
Install libvulkanbash
Install GPU driversbash
Configure startup servicebash
Install Node.jsbash
Clone a Remotion GPU demobash
With --chrome-mode="chrome-for-testing", a flavor of Chrome is used that emulates a display, which can make use of the GPU.
With --gl=vulkan, Chrome uses the right OpenGL renderer.
Warnings such as  vkCreateInstance() failed: -7 and Failed to create and initialize Vulkan implementation. may show up, however, the render should be significantly faster.
See also
- Run this in a Docker container
- How To Enable Hardware Acceleration on Chrome, Chromium & Puppeteer on AWS in Headless mode, on which this document is based on.

