Skip to content

aws-cloudfront: Support cloudfront-js-2.0 runtime #28163

@jmortlock

Description

@jmortlock

Describe the feature

Cloudfront functions support either "cloudfront-js-1.0" or "cloudfront-js-2.0" runtimes

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/functions-javascript-runtime-features.html

Use Case

AWS provide example functions here: https://github.com/aws-samples/amazon-cloudfront-functions

Not all of them are cloudfront-js-1.0 v1 compatible; specifically I was using the URL rewrites and redirect example.

Proposed Solution

Add a new enum property to allow the user to choose which runtime is used.

Other Information

Available in cloudformation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-function-functionconfig.html

Currently Hardcoded in CDK: https://github.com/aws/aws-cdk/blob/85cc0c686049ca40a0bc09589830a909e911fbdf/packages/aws-cdk-lib/aws-cloudfront/lib/function.ts#L168C19-L168C36

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.111.0

Environment details (OS name and version, etc.)

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudfrontRelated to Amazon CloudFronteffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions