Skip to content
v2.273.0

FunctionAssociation Struct ​

Represents a CloudFront function and event type when using CF Functions.

The type of the AddBehaviorOptions.functionAssociations property.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
import { aws_cloudfront as interfaces_cloudfront } from 'aws-cdk-lib/interfaces';

declare const functionRef: interfaces_cloudfront.IFunctionRef;
const functionAssociation: cloudfront.FunctionAssociation = {
  eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
  function: functionRef,
};

Properties ​

The type of event which should invoke the function.
functionIFunctionReffunctionIFunctionReffunctionIFunctionRefFunctionIFunctionRefFunctionIFunctionRefrequired#
The CloudFront function that will be invoked.