Skip to content

Conversation

@konokenj
Copy link
Contributor

@konokenj konokenj commented Feb 6, 2026

Summary

Starting October 2025, new Lambda function URLs require both lambda:InvokeFunctionUrl and lambda:InvokeFunction permissions when using CloudFront Origin Access Control (OAC).

Problem

CDK's FunctionUrlOrigin.withOriginAccessControl only adds lambda:InvokeFunctionUrl permission. New deployments after October 2025 would fail with 403 errors because the lambda:InvokeFunction permission is missing.

Solution

Explicitly add lambda:InvokeFunction permission using CfnPermission.

Reference

Dependencies

Please merge #81 first. This PR is based on that branch and will have no conflicts once #81 is merged.

CDK's NatInstanceProviderV2 uses the `route` command in its default
user data, which requires the net-tools package. However, Amazon Linux
2023 (the default AMI for NatInstanceProviderV2) doesn't have net-tools
pre-installed, causing NAT instances to fail silently.

This change provides custom user data that uses `ip route` instead of
`route` to determine the default network interface, ensuring NAT
functionality works correctly on AL2023.

Reference: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ec2/lib/nat.ts
Starting October 2025, new Lambda function URLs require both
lambda:InvokeFunctionUrl and lambda:InvokeFunction permissions when
using CloudFront Origin Access Control (OAC).

CDK's FunctionUrlOrigin.withOriginAccessControl only adds
lambda:InvokeFunctionUrl, so new deployments would fail with 403 errors.

Reference: https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html
@konokenj konokenj force-pushed the fix/cloudfront-oac-invoke-permission-v2 branch from 2e3b8a8 to eb5a5b1 Compare February 7, 2026 01:09
@konokenj
Copy link
Contributor Author

konokenj commented Feb 7, 2026

Root cause on aws-cdk aws/aws-cdk#35872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant