Skip to content

🎥 Make videos programmatically with React

Docs: Document Remotion Lambda Data transfer cost

JonnyBurger4363de200e69
diff --git a/packages/docs/docs/lambda/cost-example.mdx b/packages/docs/docs/lambda/cost-example.mdx
index 17595b54f1..b19e982512 100644
--- a/packages/docs/docs/lambda/cost-example.mdx
+++ b/packages/docs/docs/lambda/cost-example.mdx
@@ -63,9 +63,7 @@ export const calculateMetadataFn: CalculateMetadataFunction<{}> = async () => {
};
export const OffthreadRemoteVideo: React.FC = () => {
- return (
- <OffthreadVideo src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
- );
+ return <OffthreadVideo src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />;
};
```
@@ -86,9 +84,7 @@ export const calculateMetadataFn: CalculateMetadataFunction<{}> = async () => {
};
export const OffthreadRemoteVideo: React.FC = () => {
- return (
- <OffthreadVideo src="https://videos.pexels.com/video-files/5530402/5530402-uhd_3840_2160_25fps.mp4" />
- );
+ return <OffthreadVideo src="https://videos.pexels.com/video-files/5530402/5530402-uhd_3840_2160_25fps.mp4" />;
};
```
@@ -101,7 +97,7 @@ The calculation above only factors in Lambda computation cost.
This is usually the majority of the cost.
However, you also incur additional cost for:
-- Bandwidth: Pulling in assets happens always over HTTP and incurs S3 egress cost.
+- [Bandwidth](/docs/lambda/data-transfer-cost): Pulling in assets happens always over HTTP and incurs S3 egress cost.
- Storage: Storing the sites and renders in S3 incurs S3 storage.
- CloudWatch Logs: Renders are logged to CloudWatch by default.
- [Remotion Licensing](https://remotion.pro/license): Teams of 4+ people also need to acquire a Remotion Company License in addition to the AWS cost.
diff --git a/packages/docs/docs/lambda/data-transfer-cost.mdx b/packages/docs/docs/lambda/data-transfer-cost.mdx
new file mode 100644
index 0000000000..3766deb054
--- /dev/null
+++ b/packages/docs/docs/lambda/data-transfer-cost.mdx
@@ -0,0 +1,37 @@
+---
+image: /generated/articles-docs-lambda-data-transfer-cost.png
+title: Data transfer cost
+slug: /lambda/data-transfer-cost
+sidebar_label: Data transfer cost
+crumb: '@remotion/lambda'
+---
+
+When rendering on Remotion Lambda, a headless browser is opened, which opens your [bundle](/docs/terminology/bundle) via the [Serve URL](/docs/terminology/serve-url).
+Your site and assets are being loaded via HTTP, meaning that you will be charged by AWS for the data transfer.
+
+If you have big assets, these charges may add up.
+This site explains two options for reducing the cost if you have big assets.
+
+## Isn't data transfer free if the assets are in the same region?
+
+No, with the default settings, since the transfer happens over HTTP, AWS counts this as egress, even if the assets are in the same S3 region.
+
+## Option 1: Use an alternate CDN for storing assets
+
+Many people use Cloudflare R2 to store their big assets instead.
+This is easy to achieve - simply put the assets in a Cloudflare R2 bucket and reference them using the HTTP URL that you get.
+
+Cloudflare does not charge for data transfer, so this is a great way to reduce the cost.
+
+## Option 2: Enable VPC endpoints
+
+You can with some configuration set up a VPC for the Lambda function.
+
+Refer to these [notes](https://github.com/remotion-dev/remotion/issues/3817#issuecomment-3182273841) for how to enable VPC endpoints for Remotion Lambda.
+
+### Caveats
+
+- If a Lambda function already existed, this will not update the settings. Delete the Remotion Lambda function and redeploy a new one.
+- You still pay a flat fee per request.
+- Setting up a VPC endpoint might restrict other network traffic.
+- We do not have recommendations yet for how to configure the VPC endpoint.
diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.ts
index c9750245b5..3140a2a0c9 100644
--- a/packages/docs/sidebars.ts
+++ b/packages/docs/sidebars.ts
@@ -1013,6 +1013,7 @@ const sidebars: SidebarsConfig = {
'lambda/r2',
'lambda/insights',
'lambda/multiple-buckets',
+ 'lambda/data-transfer-cost',
'lambda/how-lambda-works',
'lambda/bucket-naming',
'lambda/optimizing-cost',
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index e8a340748b..0675adf797 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -2168,6 +2168,15 @@ export const articles = [
noAi: false,
slug: 'lambda/custom-layers',
},
+ {
+ id: 'lambda/data-transfer-cost',
+ title: 'Data transfer cost',
+ relativePath: 'docs/lambda/data-transfer-cost.mdx',
+ compId: 'articles-docs-lambda-data-transfer-cost',
+ crumb: '@remotion/lambda',
+ noAi: false,
+ slug: 'lambda/data-transfer-cost',
+ },
{
id: 'deletefunction',
title: 'deleteFunction()',
diff --git a/packages/docs/static/generated/articles-docs-lambda-data-transfer-cost.png b/packages/docs/static/generated/articles-docs-lambda-data-transfer-cost.png
new file mode 100644
index 0000000000..a2208bb3b3
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-lambda-data-transfer-cost.png differ