Skip to content

BuildNot yet confirmed elsewhere1 publisher2 min readPublished

CDK's OAC setup for Lambda function URLs grants CloudFront one of the two permissions it needs

CDK grants CloudFront only one of the two permissions a locked-down Lambda function URL needs, according to an October 2026 update to a dev.to tutorial. The update also moves new functions to Node.js 24, as nodejs20.x lost security patches on 30 April 2026.

The Engineer · Build desk

How we use AISend a correction

Illustration accompanying CDK's OAC setup for Lambda function URLs grants CloudFront one of the two permissions it needs
Generated illustration

What happened

  • CloudFront now supports Origin Access Control for Lambda function URLs, and paired with AWS_IAM auth it restricts invocation of the URL to the distribution.
  • The tutorial's sample code, below the update note, still pins Runtime.NODEJS_20_X and FunctionUrlAuthType.NONE with response streaming turned on.
  • The sample distribution uses the CACHING_DISABLED cache policy so every development request is forwarded to the function.

Why it matters

  • decision Teams adopting OAC through CDK have to add the lambda:InvokeFunction grant by hand for now, then remove the duplicate once a CDK release adds it automatically.
  • exposure Stacks copied from the original NONE sample leave the function URL without the distribution-only restriction that OAC is meant to enforce.
  • cost Every function built from the sample needs a move to Node.js 24 and a retest of its streaming handler, paid by whoever owns those stacks today.
  • constraint Because CACHING_DISABLED sends every request to the function, the caching that motivated the setup has to be designed separately before production.

The new pattern changes two settings [3]. The function URL's authType moves from NONE to FunctionUrlAuthType.AWS_IAM, and the CloudFront origin is built with FunctionUrlOrigin.withOriginAccessControl(fnUrl) [3]. With both in place, only the distribution can invoke the URL, according to the tutorial [3]. The author wrote that this is "the production answer to the NONE auth type I warn about in the tips below" [4].

The gap is in the function's resource policy [5]. CloudFront has to be granted both lambda:InvokeFunctionUrl and lambda:InvokeFunction [5]. The author wrote that "at the time of this update the CDK only adds the first" [6]. A stack that relies on the construct alone ships with one of the two grants [14]. The update does not show the code for the second grant or describe what a request returns without it. We would check the synthesized template for both action names before trusting a deployment. We would also keep the extra grant explicit in code, so it is easy to find when a later CDK release adds it automatically.

The runtime change has a date attached [1]. The sample function pins Runtime.NODEJS_20_X [7]. That runtime stopped receiving security patches on 30 April 2026 [1]. The author's advice is scoped to new functions: use Runtime.NODEJS_24_X [2]. The patch cutoff belongs to the runtime, so in our view functions already deployed from the sample need the same move [15]. The handler streams its response through awslambda.streamifyResponse [12]. That streaming path is what we would retest on the new runtime.

The two changes differ in urgency. The runtime cutoff has already passed [1]. The auth change is the author's production recommendation for a feature CloudFront now supports [3][4]. The evidence supports moving runtimes now. It supports leaving NONE as a change to schedule for any stack headed to production, which is how the author frames it [4].

The construct itself is good engineering. When the author's friend first tried this setup, CDK had no FunctionUrlOrigin, and his attempt with HttpOrigin did not work [8]. The author suspected the friend had missed the cache policy [10]. The sample sets CACHING_DISABLED so every request reaches the function during development [10]. The friend's goals were custom domains and customised caching from the origin [9]. A production stack built from this sample still needs a real cache policy in place of CACHING_DISABLED [9][10].

What to watch

  • A CDK release in which FunctionUrlOrigin.withOriginAccessControl grants lambda:InvokeFunction itself, making the manual grant redundant.
  • Whether the tutorial's sample code is revised from NODEJS_20_X and NONE to match its own October 2026 update note.

Clarity's read

What the record supports and how the coverage leans. The claims behind it follow.

Reality

Evidence35
Adoption
Insufficient
Hype gap+10
Incentives
Insufficient
Confidence40
Why these scores

Claim ledger

Ranked by verification strength, evidence, and original report placement.

  1. [1]

    The nodejs20.x Lambda runtime stopped receiving security patches on 30 April 2026.

    ReportedSupportedView cited source
  2. [2]

    The tutorial's update recommends Runtime.NODEJS_24_X for new functions.

    ReportedSupportedView cited source
  3. [3]

    CloudFront now supports Origin Access Control for Lambda function URLs; FunctionUrlOrigin.withOriginAccessControl(fnUrl) with authType: FunctionUrlAuthType.AWS_IAM lets only the distribution invoke the URL.

    ReportedSupportedView cited source

Sources

1 independent publisher whose own reporting we read for this story.

  1. dev.to

    1 article · October 10, 2026

    Using a Lambda Function URL with AWS CloudFront via AWS CDK

Share your take

Let Clarity write the post for you.

Signed-in readers get a short post drafted on this story in the register they choose — narrative, analytical, or a direct position — editable to the last word before it goes anywhere. The share buttons at the top of this story work without an account.

Topics and entities

Follow any of these and your For You feed starts watching them — no settings page required.

Loading related stories