# LambdaFunctionAssociation

- Source: [`aws-cloudfront/lib/web-distribution.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-cloudfront/lib/web-distribution.ts#L480)

## 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_lambda as lambda } from 'aws-cdk-lib';

declare const version: lambda.Version;
const lambdaFunctionAssociation: cloudfront.LambdaFunctionAssociation = {
  eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST,
  lambdaFunction: version,

  // the properties below are optional
  includeBody: false,
};
```

## Properties

- `eventType`: [LambdaEdgeEventType](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.LambdaEdgeEventType.html) (required) — The lambda event type defines at which event the lambda is called during the request lifecycle.

- `includeBody`: boolean = false — Allows a Lambda function to have read access to the body content.

  Only valid for "request" event types (`ORIGIN_REQUEST` or `VIEWER_REQUEST`).

- `lambdaFunction`: [IVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IVersion.html) (required) — A version of the lambda to associate.
