# EdgeLambda

Represents a Lambda function version and event type when using Lambda@Edge.

The type of the `AddBehaviorOptions.edgeLambdas` property.

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

## 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 edgeLambda: cloudfront.EdgeLambda = {
  eventType: cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST,
  functionVersion: version,

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

## Properties

- `eventType`: [LambdaEdgeEventType](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.LambdaEdgeEventType.html) (required) — The type of event in response to which should the function be invoked.

- `functionVersion`: [IVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IVersion.html) (required) — The version of the Lambda function that will be invoked.

  **Note**: it's not possible to use the '$LATEST' function version for Lambda@Edge!

- `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`).
  See https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-include-body-access.html
