PageSourceSearch

https://www.remotion.dev/assets/js/b0898ba6.5e3f8dda92c9.js

js remotion.dev collected 2026-09-24 19:24:57 UTC 32,547 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([["10524"],{47140(e,n,s){s.r(n),s.d(n,{metadata:()=>a,default:()=>h,frontMatter:()=>i,contentTitle:()=>c,toc:()=>d,assets:()=>p});var a=JSON.parse('{"id":"lambda/custom-layers","title":"Custom Layers","description":"The Lambda function includes Chrome and base fonts by default.","source":"@site/docs/lambda/custom-layers.mdx","sourceDirName":"lambda","slug":"/lambda/custom-layers","permalink":"/docs/lambda/custom-layers","draft":false,"unlisted":false,"editUrl":"https://github.com/remotion-dev/remotion/edit/main/packages/docs/docs/lambda/custom-layers.mdx","tags":[],"version":"current","lastUpdatedAt":1790262572000,"frontMatter":{"image":"/generated/articles-docs-lambda-custom-layers.png","title":"Custom Layers","slug":"custom-layers","crumb":"Lambda"},"sidebar":"mainSidebar","previous":{"title":"Light client","permalink":"/docs/lambda/light-client"},"next":{"title":"Separating environments","permalink":"/docs/lambda/separate-environments"}}'),o=s(57825),t=s(29721),l=s(62709),r=s(90669);let i={image:"/generated/articles-docs-lambda-custom-layers.png",title:"Custom Layers",slug:"custom-layers",crumb:"Lambda"},c,p={},d=[{value:"Default layers<AvailableFrom></AvailableFrom>",id:"default-layers",level:2},{value:"Ensure Remotion version",id:"ensure-remotion-version",level:2},{value:"Creating a custom binary",id:"creating-a-custom-binary",level:2},{value:"Creating a Lambda layer",id:"creating-a-lambda-layer",level:2},{value:"Specify custom Layers while deploying<AvailableFrom></AvailableFrom>",id:"specify-custom-layers-while-deploying",level:2},{value:"Update the Lambda function",id:"update-the-lambda-function",level:2},{value:"See also",id:"see-also",level:2}];function u(e){let n={a:"a",admonition:"admonition",br:"br",code:"code",div:"div",h2:"h2",li:"li",p:"p",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,t.R)(),...e.components}
1,{AvailableFrom:s,RawMarkdownCarrier:a}=n;return s||m("AvailableFrom",!0),a||m("RawMarkdownCarrier",!0),(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a,{raw:'---\nimage: /generated/articles-docs-lambda-custom-layers.png\ntitle: Custom Layers\nslug: custom-layers\ncrumb: \'Lambda\'\n---\n\nimport Tabs from \'@theme/Tabs\';\nimport TabItem from \'@theme/TabItem\';\n\nThe Lambda function [includes Chrome and base fonts by default](/docs/lambda/runtime).\n\nIn some advanced use cases, you want to replace certain parts of the stack:\n\n- Use another Chrome version (you may need to [build it yourself](https://github.com/remotion-dev/chrome-build-instructions/tree/main))\n- Replace default fonts or emojis\n\nBefore you create a custom stack, feel free to contact us to see if Remotion can provide the changes upstream.\n\nAlso consider that the AWS Lambda layers cumulatively may not exceed 250MB extracted, so you need to sacrifice an equal amount of other files.\n\nIf you just want to add fonts, we recommend to use [Web fonts](/docs/fonts) instead.\n\n## Default layers<AvailableFrom v="4.0.205"/>\n\nConsider using our layer options before creating a custom stack:\n\nWith the default option (`--runtime-preference=cjk` or no option):\n\n| Item         | Size     |\n| ------------ | -------- |\n| chromium     | 196 MB   |\n| emoji-google | 9.9 MB   |\n| fonts        | 1.9 MB   |\n| cjk          | 16 MB    |\n| **Total**    | 223.8 MB |\n\nWith the option [`--runtime-preference=apple-emojis`](/docs/lambda/deployfunction#runtimepreference):\n\n| Item        | Size     |\n| ----------- | -------- |\n| chromium    | 196 MB   |\n| emoji-apple | 45 MB    |\n| fonts       | 1.9 MB   |\n| **Total**   | 242.9 MB |\n\n:::note\nNumbers are currently outdated since the last Chromium update.\n:::\n\n:::note\nNote that by enabling the Apple Emojis, to stay under the 250 MB limit, support for CJK (Chinese, Japanese, Korean) characters will be removed.  \nGoogle Emojis are also removed.\n:::\n\n## Ensure Remotion version\n\nCustomizing Remotion Lambda Layers is possible from v3.0.17.  \nLambda binaries might change in minor Remotion versions, it is your responsibility to keep your versions up to date.\n\n## Creating a custom binary\n\nGo to the [`remotion-dev/lambda-binaries`](https://github.com/remotion-dev/lambda-binaries) repository and clone it.\n\nThe folders `chromium` and `fonts` contain the binaries for the ARM version. The x64 version has been discontinued.\n\nPut the files that you want in the corresponding folders - for example, add the Apple Emoji Font `AppleColorEmoji.ttf` into the `fonts/.fonts/NotoSans/` folder.\n\nSince the AWS Lambda layers may not exceed 250MB extracted, we need to sacrifice an equal amount of other files - for example by removing `fonts/.fonts/NotoColorEmoji.ttf` and `fonts/.fonts/NotoSansCJKjp-Regular.otf`.\n\nYou can see the size of the folders by running:\n\n```bash\nsh size.sh\n```\n\nIf you are done with your changes, run:\n\n```bash\nsh make.sh\n```\n\nThis will zip the layers and put them as artifacts in the `out` directory.\n\n## Creating a Lambda layer\n\n- Go to your AWS console, select the Lambda product, then select "Layers":\n\n<img src="/img/lambda-layers-console.png" />\n\n- Select "Create layer" and fill out the name. Upload the created layer from the `out` folder into the form. The fields "Compatible architectures", "Compatible runtimes" and "License" are optional.\n\n- Once the layer is created, you will get a version ARN (example: `arn:aws:lambda:us-east-1:123456789012:layer:apple-emoji:1`). Copy it.\n\n:::note\nYou need to do this for every AWS region you want to use Remotion Lambda in.\n:::\n\n## Specify custom Layers while deploying<AvailableFrom v="4.0.510" />\n\nPass every runtime Layer to [`deployFunction()`](/docs/lambda/deployfunction#customlayerarns) or [`--custom-layer-arns`](/docs/lambda/cli/functions/deploy#--custom-layer-arns). The list replaces all Remotion-hosted Layers.\n\nCredentials used to deploy custom Layers need `lambda:GetLayerVersion` permission for the specified Layer ARNs. Updating an existing function additionally needs `lambda:GetFunctionConfiguration` and `lambda:UpdateFunctionConfiguration`.\n\nCustom Layers are required in [AWS China regions](/docs/lambda/aws-china-regions).\n\n## Update the Lambda function\n\nBefore you continue, make sure a Remotion Lambda function is deployed.\n\nTo switch out the layer of a deployed Lambda function, you can either do it via the AWS console or use a Node.JS script that you can run after every function deploy.\n\n<Tabs\ndefaultValue="node"\nvalues={[\n{ label: \'N
1ode.JS\', value: \'node\', },\n{ label: \'AWS console\', value: \'deploy\', },\n]\n}>\n<TabItem value="deploy">\n\n- Go to your AWS console, select the Lambda product, then select the Lambda function you would like to update.\n- Click on "Layers":\n\n<img src="/img/lambda-single-layer.png" />\n\n- Click on "Edit", then select the layer you\'d like to replace, then click "Remove", then click "Save".\n- Once returned, click "Add a layer", then click "Specify an ARN", then paste in the layer version ARN you retrieved from the previous step.\n- Click "Verify" and then "Add".\n\nCongrats! You customized your Lambda function.\n\n</TabItem>\n<TabItem value="node">\n\nBefore you can update a function via the Node.JS APIs, you need to [add another rule to your user role](/docs/lambda/setup#5-create-an-access-key-for-the-user):\n\n```json\n[\n  {\n    "Sid": "UpdateFunction",\n    "Effect": "Allow",\n    "Action": ["lambda:GetFunctionConfiguration", "lambda:UpdateFunctionConfiguration"],\n    "Resource": ["arn:aws:lambda:*:*:function:remotion-render-*"]\n  },\n  {\n    "Sid": "GetOwnLayerVersion",\n    "Effect": "Allow",\n    "Action": ["lambda:GetLayerVersion"],\n    "Resource": ["*"]\n  }\n]\n```\n\nGiven a region, function name, layer to remove and layer to add, you can use the following snippet to update a function with custom layers\n\n```ts\nimport {AwsRegion, getAwsClient} from \'@remotion/lambda\';\n\n// Customize these parameters\nconst REGION: AwsRegion = \'us-east-1\';\nconst FUNCTION_NAME = \'remotion-render-2022-06-02-mem3000mb-disk2048mb-120sec\';\nconst LAYER_TO_REMOVE = /fonts/;\nconst LAYER_TO_ADD = \'arn:aws:lambda:us-east-1:1234567891:layer:apple-emoji:1\';\n\nconst {client, sdk} = getAwsClient({\n  region: REGION,\n  service: \'lambda\',\n});\n\nconst fnConfig = await client.send(\n  new sdk.GetFunctionConfigurationCommand({\n    FunctionName: FUNCTION_NAME,\n  }),\n);\n\nif (!fnConfig) {\n  throw new Error(`Function ${FUNCTION_NAME} not deployed`);\n}\n\nawait client.send(\n  new sdk.UpdateFunctionConfigurationCommand({\n    FunctionName: FUNCTION_NAME,\n    Layers: [...(fnConfig.Layers ?? []).filter((l) => !l.Arn?.match(LAYER_TO_REMOVE)).map((l) => l.Arn as string), LAYER_TO_ADD],\n  }),\n);\n```\n\n</TabItem>\n</Tabs>\n\n## See also\n\n- [Lambda runtime](/docs/lambda/runtime)\n'}),"\n","\n",(0,o.jsxs)(n.p,{children:["The Lambda function ",(0,o.jsx)(n.a,{href:"/docs/lambda/runtime",children:"includes Chrome and base fonts by default"}),"."]}),"\n",(0,o.jsx)(n.p,{children:"In some advanced use cases, you want to replace certain parts of the stack:"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["Use another Chrome version (you may need to ",(0,o.jsx)(n.a,{href:"https://github.com/remotion-dev/chrome-build-instructions/tree/main",children:"build it yourself"}),")"]}),"\n",(0,o.jsx)(n.li,{children:"Replace default fonts or emojis"}),"\n"]}),"\n",(0,o.jsx)(n.p,{children:"Before you create a custom stack, feel free to contact us to see if Remotion can provide the changes upstream."}),"\n",(0,o.jsx)(n.p,{children:"Also consider that the AWS Lambda layers cumulatively may not exceed 250MB extracted, so you need to sacrifice an equal amount of other files."}),"\n",(0,o.jsxs)(n.p,{children:["If you just want to add fonts, we recommend to use ",(0,o.jsx)(n.a,{href:"/docs/fonts",children:"Web fonts"})," instead."]}),"\n",(0,o.jsxs)(n.h2,{id:"default-layers",children:["Default layers",(0,o.jsx)(s,{v:"4.0.205"})]}),"\n",(0,o.jsx)(n.p,{children:"Consider using our layer options before creating a custom stack:"}),"\n",(0,o.jsxs)(n.p,{children:["With the default option (",(0,o.jsx)(n.code,{children:"--runtime-preference=cjk"})," or no option):"]}),"\n",(0,o.jsxs)(n.table,{children:[(0,o.jsx)(n.thead,{children:(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.th,{children:"Item"}),(0,o.jsx)(n.th,{children:"Size"})]})}),(0,o.jsxs)(n.tbody,{children:[(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"chromium"}),(0,o.jsx)(n.td,{children:"196 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"emoji-google"}),(0,o.jsx)(n.td,{children:"9.9 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"fonts"}),(0,o.jsx)(n.td,{children:"1.9 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"cjk"}),(0,o.jsx)(n.td,{children:"16 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:(0,o.jsx)(n.strong,{children:"Total"})}),(0,o.jsx)(n.td,{children:"223.8 MB"})]})]})]}),"\n",(0,o.jsxs)(n.p,{children:["With the option ",(0,o.jsx)(n.a,{href:"/docs/lambda/deployfunction#runtimepreference",children:(0,o.jsx)(n.code,{children:"--runtime-preference=apple-emojis"})}),":"]}),"\n",(0,o.jsxs)(n.table,{children:[(0,o.jsx)(n.thead,{children:(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.th,{children:"Item"}),(0,o.jsx)(n.th,{children:"Size"})]})}),(0,o.jsxs)(n.tbody,{children:[(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"chromium"}),(0,o.jsx)(n.td,{children:"196 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"emoji-apple"}),(0,o.jsx)(n.td,{children:"45 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:"fonts"}),(0,o.jsx)(n.td,{children:"1.9 MB"})]}),(0,o.jsxs)(n.tr,{children:[(0,o.jsx)(n.td,{children:(0,o.jsx)(n.strong,{children:"Total"})}),(0,o.jsx)(n.td,{children:"242.9 MB"})]})]})]}),"\n",(0,o.jsx)(n.admonition,{type:"note",children:(0,o.jsx)(n.p,{children:"Numbers are currently outdated since the last Chromium update."})}),"\n",(0,o.jsx)(n.admonition,{type:"note",children:(0,o.jsxs)(n.p,{children:["Note that by enabling the Apple Emojis, to stay under the 250 MB limit, support for CJK (Chinese, Japanese, Korean) characters will be removed.",(0,o.jsx)(n.br,{}),"\n","Google Emojis are also removed."]})}),"\n",(0,o.jsx)(n.h2,{id:"ensure-remotion-version",children:"Ensure Remotion version"}),"\n",(0,o.jsxs)(n.p,{children:["Customizing Remotion Lambda Layers is possible from v3.0.17.",(0,o.jsx)(n.br,{}),"\n","Lambda binaries might change in minor Remotion versions, it is your responsibility to keep your versions up to date."]}),"\n",(0,o.jsx)(n.h2,{id:"creating-a-custom-binary",children:"Creating a custom binary"}),"\n",(0,o.jsxs)(n.p,{children:["Go to the ",(0,o.jsx)(n.a,{href:"https://github.com/remotion-dev/lambda-binaries",children:(0,o.jsx)(n.code,{children:"remotion-dev/lambda-binaries"})})," repository and clone it."]}),"\n",(0,o.jsxs)(n.p,{children:["The folders ",(0,o.jsx)(n.code,{children:"chromium"})," and ",(0,o.jsx)(n.code,{children:"fonts"})," contain the binaries for the ARM version. The x64 version has been discontinued."]}),"\n",(0,o.jsxs)(n.p,{children:["Put the files that you want in the corresponding folders - for example, add the Apple Emoji Font ",(0,o.jsx)(n.code,{children:"AppleColorEmoji.ttf"})," into the ",(0,o.jsx)(n.code,{children:"fonts/.fonts/NotoSans/"})," folder."]}
1),"\n",(0,o.jsxs)(n.p,{children:["Since the AWS Lambda layers may not exceed 250MB extracted, we need to sacrifice an equal amount of other files - for example by removing ",(0,o.jsx)(n.code,{children:"fonts/.fonts/NotoColorEmoji.ttf"})," and ",(0,o.jsx)(n.code,{children:"fonts/.fonts/NotoSansCJKjp-Regular.otf"}),"."]}),"\n",(0,o.jsx)(n.p,{children:"You can see the size of the folders by running:"}),"\n",(0,o.jsx)(n.div,{dangerouslySetInnerHTML:{__html:'<pre class="shiki github-dark" style="background-color:#24292e;color:#e1e4e8" tabindex="0"><code><span class="line"><span style="color:#B392F0">sh</span><span style="color:#9ECBFF"> size.sh</span></span></code><button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>'}}),"\n",(0,o.jsx)(n.p,{children:"If you are done with your changes, run:"}),"\n",(0,o.jsx)(n.div,{dangerouslySetInnerHTML:{__html:'<pre class="shiki github-dark" style="background-color:#24292e;color:#e1e4e8" tabindex="0"><code><span class="line"><span style="color:#B392F0">sh</span><span style="color:#9ECBFF"> make.sh</span></span></code><button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>'}}),"\n",(0,o.jsxs)(n.p,{children:["This will zip the layers and put them as artifacts in the ",(0,o.jsx)(n.code,{children:"out"})," directory."]}),"\n",(0,o.jsx)(n.h2,{id:"creating-a-lambda-layer",children:"Creating a Lambda layer"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:'Go to your AWS console, select the Lambda product, then select "Layers":'}),"\n"]}),"\n",(0,o.jsx)("img",{src:"/img/lambda-layers-console.png"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsxs)(n.p,{children:['Select "Create layer" and fill out the name. Upload the created layer from the ',(0,o.jsx)(n.code,{children:"out"}),' folder into the form. The fields "Compatible architectures", "Compatible runtimes" and "License" are optional.']}),"\n"]}),"\n",(0,o.jsxs)(n.li,{children:["\n",(0,o.jsxs)(n.p,{children:["Once the layer is created, you will get a version ARN (example: ",(0,o.jsx)(n.code,{children:"arn:aws:lambda:us-east-1:123456789012:layer:apple-emoji:1"}),"). Copy it."]}),"\n"]}),"\n"]}),"\n",(0,o.jsx)(n.admonition,{type:"note",children:(0,o.jsx)(n.p,{children:"You need to do this for every AWS region you want to use Remotion Lambda in."})}),"\n",(0,o.jsxs)(n.h2,{id:"specify-custom-layers-while-deploying",children:["Specify custom Layers while deploying",(0,o.jsx)(s,{v:"4.0.510"})]}),"\n",(0,o.jsxs)(n.p,{children:["Pass every runtime Layer to ",(0,o.jsx)(n.a,{href:"/docs/lambda/deployfunction#customlayerarns",children:(0,o.jsx)(n.code,{children:"deployFunction()"})})," or ",(0,o.jsx)(n.a,{href:"/docs/lambda/cli/functions/deploy#--custom-layer-arns",children:(0,o.jsx)(n.code,{children:"--custom-layer-arns"})}),". The list replaces all Remotion-hosted Layers."]}),"\n",(0,o.jsxs)(n.p,{children:["Credentials used to deploy custom Layers need ",(0,o.jsx)(n.code,{children:"lambda:GetLayerVersion"})," permission for the specified Layer ARNs. Updating an existing function additionally needs ",(0,o.jsx)(n.code,{children:"lambda:GetFunctionConfiguration"})," and ",(0,o.jsx)(n.code,{children:"lambda:UpdateFunctionConfiguration"}),"."]}),"\n",(0,o.jsxs)(n.p,{children:["Custom Layers are required in ",(0,o.jsx)(n.a,{href:"/docs/lambda/aws-china-regions",children:"AWS China regions"}),"."]}),"\n",(0,o.jsx)(n.h2,{id:"update-the-lambda-function",children:"Update the Lambda function"}),"\n",(0,o.jsx)(n.p,{children:"Before you continue, make sure a Remotion Lambda function is deployed."}),"\n",(0,o.jsx)(n.p,{children:"To switch out the layer of a deployed Lambda function, you can either do it via the AWS console or use a Node.JS script that you can run after every function deploy."}),"\n",(0,o.jsxs)(l.A,{defaultValue:"node",values:[{label:"Node.JS",value:"node"},{label:"AWS console",value:"deploy"}],children:[(0,o.jsxs)(r.A,{value:"deploy",children:[(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:"Go to your AWS console, select the Lambda product, then select the Lambda function you would like to update."}),"\n",(0,o.jsx)(n.li,{children:'Click on "Layers":'}),"\n"]}),(0,o.jsx)("img",{src:"/img/lambda-single-layer.png"}),(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:'Click on "Edit", then select the layer you\'d like to replace, then click "Remove", then click "Save".'}
1),"\n",(0,o.jsx)(n.li,{children:'Once returned, click "Add a layer", then click "Specify an ARN", then paste in the layer version ARN you retrieved from the previous step.'}),"\n",(0,o.jsx)(n.li,{children:'Click "Verify" and then "Add".'}),"\n"]}),(0,o.jsx)(n.p,{children:"Congrats! You customized your Lambda function."})]}),(0,o.jsxs)(r.A,{value:"node",children:[(0,o.jsxs)(n.p,{children:["Before you can update a function via the Node.JS APIs, you need to ",(0,o.jsx)(n.a,{href:"/docs/lambda/setup#5-create-an-access-key-for-the-user",children:"add another rule to your user role"}),":"]}),(0,o.jsx)(n.div,{dangerouslySetInnerHTML:{__html:'<pre class="shiki github-dark" style="background-color:#24292e;color:#e1e4e8" tabindex="0"><code><span class="line"><span style="color:#E1E4E8">[</span></span>\n<span class="line"><span style="color:#E1E4E8">  {</span></span>\n<span class="line"><span style="color:#79B8FF">    "Sid"</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">"UpdateFunction"</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#79B8FF">    "Effect"</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">"Allow"</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#79B8FF">    "Action"</span><span style="color:#E1E4E8">: [</span><span style="color:#9ECBFF">"lambda:GetFunctionConfiguration"</span><span style="color:#E1E4E8">, </span><span style="color:#9ECBFF">"lambda:UpdateFunctionConfiguration"</span><span style="color:#E1E4E8">],</span></span>\n<span class="line"><span style="color:#79B8FF">    "Resource"</span><span style="color:#E1E4E8">: [</span><span style="color:#9ECBFF">"arn:aws:lambda:*:*:function:remotion-render-*"</span><span style="color:#E1E4E8">]</span></span>\n<span class="line"><span style="color:#E1E4E8">  },</span></span>\n<span class="line"><span style="color:#E1E4E8">  {</span></span>\n<span class="line"><span style="color:#79B8FF">    "Sid"</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">"GetOwnLayerVersion"</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#79B8FF">    "Effect"</span><span style="color:#E1E4E8">: </span><span style="color:#9ECBFF">"Allow"</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#79B8FF">    "Action"</span><span style="color:#E1E4E8">: [</span><span style="color:#9ECBFF">"lambda:GetLayerVersion"</span><span style="color:#E1E4E8">],</span></span>\n<span class="line"><span style="color:#79B8FF">    "Resource"</span><span style="color:#E1E4E8">: [</span><span style="color:#9ECBFF">"*"</span><span style="color:#E1E4E8">]</span></span>\n<span class="line"><span style="color:#E1E4E8">  }</span></span>\n<span class="line"><span style="color:#E1E4E8">]</span></span></code><button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>'}}),(0,o.jsx)(n.p,{children:"Given a region, function name, layer to remove and layer to add, you can use the following snippet to update a function with custom layers"}),(0,o.jsx)(n.div,{dangerouslySetInnerHTML:{__html:'<pre class="shiki github-dark" style="background-color:#24292e;color:#e1e4e8" tabindex="0"><code><span class="line"><span style="color:#F97583">import</span><span style="color:#E1E4E8"> {AwsRegion, getAwsClient} </span><span style="color:#F97583">from</span><span style="color:#9ECBFF"> \'@remotion/lambda\'</span><span style="color:#E1E4E8">;</span></span>\n<span class="line"></span>\n<span class="line"><span style="color:#6A737D">// Customize these parameters</span></span>\n<span class="line"><span style="color:#F97583">const</span><span style="color:#79B8FF"> REGION</span><span style="color:#F97583">:</span><span style="color:#B392F0"> AwsRegion</span><span style="color:#F97583"> =</span><span style="color:#9ECBFF"> \'us-east-1\'</span><span style="color:#E1E4E8">;</span></span>\n<span class="line"><span style="color:#F97583">const</span><span style="color:#79B8FF"> FUNCTION_NAME</span><span style="color:#F97583"> =</span><span style="color:#9ECBFF"> \'remotion-render-2022-06-02-mem3000mb-disk2048mb-120sec\'</span><span style="color:#E1E4E8">;</span></span>\n<span class="line"><span style="color:#F97583">const</span><span style="color:#79B8FF"> LAYER_TO_REMOVE</span><span style="color:#F97583"> =</span><span style="color:#9ECBFF"> /</span><span style="color:#DBEDFF">fonts</span><span style="color:#9ECBFF">/</span><span style="color:#E1E4E8">;</span></span>\n<span class="line"><span style="color:#F97583">const</span><span style="color:#79B8FF"> LAYER_TO_ADD</span><span style="color:#F97583"> =</span><span style="color:#9ECBFF"> \'arn:aws:lambda:us-east-1:1234567891:layer:apple-emoji:1\'</span><span style="color:#E1E4E8">;</span></span>\n<span class="line"></span>\n<span class="line"><span style="color:#F97583">const</span><span style="color:#E1E4E8"> {</span><span style="color:#79B8FF">client</span><span style="color:#E1E4E8">, </span><span style="color:#79B8FF">sdk</span><span style="color:#E1E4E8">}
1 </span><span style="color:#F97583">=</span><span style="color:#B392F0"> getAwsClient</span><span style="color:#E1E4E8">({</span></span>\n<span class="line"><span style="color:#E1E4E8">  region: </span><span style="color:#79B8FF">REGION</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#E1E4E8">  service: </span><span style="color:#9ECBFF">\'lambda\'</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#E1E4E8">});</span></span>\n<span class="line"></span>\n<span class="line"><span style="color:#F97583">const</span><span style="color:#79B8FF"> fnConfig</span><span style="color:#F97583"> =</span><span style="color:#F97583"> await</span><span style="color:#E1E4E8"> client.</span><span style="color:#B392F0">send</span><span style="color:#E1E4E8">(</span></span>\n<span class="line"><span style="color:#F97583">  new</span><span style="color:#E1E4E8"> sdk.</span><span style="color:#B392F0">GetFunctionConfigurationCommand</span><span style="color:#E1E4E8">({</span></span>\n<span class="line"><span style="color:#E1E4E8">    FunctionName: </span><span style="color:#79B8FF">FUNCTION_NAME</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#E1E4E8">  }),</span></span>\n<span class="line"><span style="color:#E1E4E8">);</span></span>\n<span class="line"></span>\n<span class="line"><span style="color:#F97583">if</span><span style="color:#E1E4E8"> (</span><span style="color:#F97583">!</span><span style="color:#E1E4E8">fnConfig) {</span></span>\n<span class="line"><span style="color:#F97583">  throw</span><span style="color:#F97583"> new</span><span style="color:#B392F0"> Error</span><span style="color:#E1E4E8">(</span><span style="color:#9ECBFF">`Function ${</span><span style="color:#79B8FF">FUNCTION_NAME</span><span style="color:#9ECBFF">} not deployed`</span><span style="color:#E1E4E8">);</span></span>\n<span class="line"><span style="color:#E1E4E8">}</span></span>\n<span class="line"></span>\n<span class="line"><span style="color:#F97583">await</span><span style="color:#E1E4E8"> client.</span><span style="color:#B392F0">send</span><span style="color:#E1E4E8">(</span></span>\n<span class="line"><span style="color:#F97583">  new</span><span style="color:#E1E4E8"> sdk.</span><span style="color:#B392F0">UpdateFunctionConfigurationCommand</span><span style="color:#E1E4E8">({</span></span>\n<span class="line"><span style="color:#E1E4E8">    FunctionName: </span><span style="color:#79B8FF">FUNCTION_NAME</span><span style="color:#E1E4E8">,</span></span>\n<span class="line"><span style="color:#E1E4E8">    Layers: [</span><span style="color:#F97583">...</span><span style="color:#E1E4E8">(fnConfig.Layers </span><span style="color:#F97583">??</span><span style="color:#E1E4E8"> []).</span><span style="color:#B392F0">filter</span><span style="color:#E1E4E8">((</span><span style="color:#FFAB70">l</span><span style="color:#E1E4E8">) </span><span style="color:#F97583">=></span><span style="color:#F97583"> !</span><span style="color:#E1E4E8">l.Arn?.</span><span style="color:#B392F0">match</span><span style="color:#E1E4E8">(</span><span style="color:#79B8FF">LAYER_TO_REMOVE</span><span style="color:#E1E4E8">)).</span><span style="color:#B392F0">map</span><span style="color:#E1E4E8">((</span><span style="color:#FFAB70">l</span><span style="color:#E1E4E8">) </span><span style="color:#F97583">=></span><span style="color:#E1E4E8"> l.Arn </span><span style="color:#F97583">as</span><span style="color:#79B8FF"> string</span><span style="color:#E1E4E8">), </span><span style="color:#79B8FF">LAYER_TO_ADD</span><span style="color:#E1E4E8">],</span></span>\n<span class="line"><span style="color:#E1E4E8">  }),</span></span>\n<span class="line"><span style="color:#E1E4E8">);</span></span></code><button class="copy-button" aria-label="Copy code to clipboard">Copy</button></pre>'}})]})]}),"\n",(0,o.jsx)(n.h2,{id:"see-also",children:"See also"}),"\n",(0,o.jsxs)(n.ul,{children:["\n",(0,o.jsx)(n.li,{children:(0,o.jsx)(n.a,{href:"/docs/lambda/runtime",children:"Lambda runtime"})}),"\n"]})]})}function h(e={}){let{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(u,{...e})}):u(e)}function m(e,n){throw Error("Expected "+(n?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},90669(e,n,s){s.d(n,{A:()=>r});var a=s(57825);s(67781);var o=s(98573),t=s(63688);function l({children:e,className:n,hidden:s}){return(0,a.jsx)("div",{role:"tabpanel",className:(0,o.A)("tabItem_hjd2",n),hidden:s,children:e})}function r({children:e,className:n,value:s}){let{selectedValue:o,lazy:i}=(0,t.uc)(),c=s===o;return!c&&i?null:(0,a.jsx)(l,{className:n,hidden:!c,children:e})}},62709(e,n,s){s.d(n,{A:()=>u});var a=s(57825);s(67781);var o=s(98573),t=s(91404),l=s(63688),r=s(10331),i=s(12065);function c({className:e}){let{selectedValue:n,selectValue:s,tabValues:t,block:i}=(0,l.uc)(),p=[],{blockElementScrollPositionUntilNextRender:d}=(0,r.a_)(),u=e=>{let a=e.currentTarget,o=t[p.indexOf(a)].value;o!==n&&(d(a),s(o))},h=e=>{let n=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{let s=p.indexOf(e.currentTarget)+1;n=p[s]??p[0];break}case"ArrowLeft":{let s=p.indexOf(e.currentTarget)-1;n=p[s]??p[p.length-1]}}n?.focus()};return(0,a.jsx)("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.A)("tabs",{"tabs--block":i},e),children:t.map(({value:e,label:s,attributes:t})=>(0,a.jsx)("li",{role:"tab",tabIndex:n===e?0:-1,"aria-selected":n===e,ref:e=>{p.push(e)},onKeyDown:h,onClick:u,...t,className:(0,o.A)("tabs__item","tabItem_rhlu",t?.className,{"tabs__item--active":n===e}),children:s??e},e))})}function p({children:e}){return(0,a.jsx)("div",{className:"margin-top--md",children:e})}function d({className:e,children:n}){return(0,a.jsxs)("div",{className:(0,o.A)(t.G.tabs.container,"tabs-container","tabList_eNpY"),children:[(0,a.jsx)(c,{className:e}),(0,a.jsx)(p,{children:n})]})}function u(e){let n=(0,i.A)(),s=(0,l.OC)(e);return(0,a.jsx)(l.O_,{value:s,children:(0,a.jsx)(d,{className:e.className,children:(0,l.vT)(e.children)})},String(n))}},76245(e,n,s){function a(e,n=(e,n)=>e===n){return e.filter((s,a)=>e.findIndex(e=>n(e,s))!==a)}function o(e,n){let s={},a=0;for(let o of e){let e=n(o,a);s[e]??=[],s[e].push(o),a+=1}return s}s.d(n,{$z:()=>o,XI:()=>a})},63688(e,n,s){s.d(n,{OC:()=>u,O_:()=>y,uc:()=>m,vT:()=>p});var a=s(57825),o=s(67781),t=s(71864),l=s(81219),r=s(57932),i=s(76245),c=s(2559);function p(e){return o.Children.toArray(e).filter(e=>"\n"!==e)}function d({value:e,tabValues:n}){return n.some(n=>n.value===e)}function u(e){let n,{defaultValue:s,queryString:a=!1,groupId:p}=e,u=function(e){let{values:n,children:s}=e;return(0,o.useMemo)(()=>{let e=n??o.Children.toArray(s).flatMap(e=>{if(!e)return[];if((0,o.isValidElement)(e)&&function(e){let{props:n}=e;return!!n&&"object"==typeof n&&"value"in n}(e))return[e];
1let n="string"==typeof e.type?e.type:e.type.name;throw Error(`Docusaurus error: Bad <Tabs> child <${n}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique "value" prop.
2If you do not want to pass on a "value" prop to the direct children of <Tabs>, you can also pass an explicit <Tabs values={...}> prop.`)}).map(({props:{value:e,label:n,attributes:s,default:a}})=>({value:e,label:n,attributes:s,default:a})),a=(0,i.XI)(e,(e,n)=>e.value===n.value);if(a.length>0)throw Error(`Docusaurus error: Duplicate values "${a.map(e=>`'${e.value}'`).join(", ")}" found in <Tabs>. Every value needs to be unique.`);return e},[n,s])}(e),[h,m]=(0,o.useState)(()=>(function({defaultValue:e,tabValues:n}){if(0===n.length)throw Error("Docusaurus error: the <Tabs> component requires at least one <TabItem> children component");if(e){if(!d({value:e,tabValues:n}))throw Error(`Docusaurus error: The <Tabs> has a defaultValue "${e}" but none of its children has the corresponding value. Available values are: ${n.map(e=>e.value).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return e}let s=n.find(e=>e.default)??n[0];if(!s)throw Error("Unexpected error: 0 tabValues");return s.value})({defaultValue:s,tabValues:u})),[y,f]=function({queryString:e=!1,groupId:n}){let s=(0,t.W6)(),a=function({queryString:e=!1,groupId:n}){if("string"==typeof e)return e;if(!1===e)return null;if(!0===e&&!n)throw Error('Docusaurus error: The <Tabs> component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:e,groupId:n});return[(0,r.aZ)(a),(0,o.useCallback)(e=>{if(!a)return;let n=new URLSearchParams(s.location.search);n.set(a,e),s.replace({...s.location,search:n.toString()})},[a,s])]}({queryString:a,groupId:p}),[E,b]=function({groupId:e}){let n=e?`docusaurus.tab.${e}`:null,[s,a]=(0,c.Dv)(n);return[s,(0,o.useCallback)(e=>{n&&a.set(e)},[n,a])]}({groupId:p}),x=d({value:n=y??E,tabValues:u})?n:null;return(0,l.A)(()=>{x&&m(x)},[x]),{selectedValue:h,selectValue:(0,o.useCallback)(e=>{if(!d({value:e,tabValues:u}))throw Error(`Can't select invalid tab value=${e}`);m(e),f(e),b(e)},[f,b,u]),tabValues:u,lazy:e.lazy??!1,block:e.block??!1}}let h=(0,o.createContext)(null);function m(){let e=o.useContext(h);if(!e)throw Error("useTabsContext() must be used within a Tabs component");return e}function y(e){return(0,a.jsx)(h.Provider,{value:e.value,children:e.children})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.