EdgeLambda Struct
Represents a Lambda function version and event type when using Lambda@Edge.
The type of the AddBehaviorOptions.edgeLambdas 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_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,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudfront as cloudfront
from aws_cdk import aws_lambda as lambda_
# version: lambda.Version
edge_lambda = cloudfront.EdgeLambda(
event_type=cloudfront.LambdaEdgeEventType.ORIGIN_REQUEST,
function_version=version,
# the properties below are optional
include_body=False
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudfront.*;
import software.amazon.awscdk.services.lambda.*;
Version version;
EdgeLambda edgeLambda = EdgeLambda.builder()
.eventType(LambdaEdgeEventType.ORIGIN_REQUEST)
.functionVersion(version)
// the properties below are optional
.includeBody(false)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
using Amazon.CDK.AWS.Lambda;
Version version;
var edgeLambda = new EdgeLambda {
EventType = LambdaEdgeEventType.ORIGIN_REQUEST,
FunctionVersion = version,
// the properties below are optional
IncludeBody = false
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var version Version
edgeLambda := &EdgeLambda{
EventType: awscdk.Aws_cloudfront.LambdaEdgeEventType_ORIGIN_REQUEST,
FunctionVersion: version,
// the properties below are optional
IncludeBody: jsii.Boolean(false),
}
Properties
eventTypeLambdaEdgeEventTypeevent_typeLambdaEdgeEventTypeeventTypeLambdaEdgeEventTypeEventTypeLambdaEdgeEventTypeEventTypeLambdaEdgeEventTyperequired#The type of event in response to which should the function be invoked.
functionVersionIVersionfunction_versionIVersionfunctionVersionIVersionFunctionVersionIVersionFunctionVersionIVersionrequired#The version of the Lambda function that will be invoked.
Note: it's not possible to use the '$LATEST' function version for Lambda@Edge!
includeBodyoptionalbooleaninclude_bodyoptionalboolincludeBodyoptionalBooleanIncludeBodyoptionalboolIncludeBodyoptional*bool= 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