aws-cdk-lib.aws_cloudfront.LambdaEdgeEventType

enum LambdaEdgeEventType

LanguageType name
.NETAmazon.CDK.AWS.CloudFront.LambdaEdgeEventType
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#LambdaEdgeEventType
Javasoftware.amazon.awscdk.services.cloudfront.LambdaEdgeEventType
Pythonaws_cdk.aws_cloudfront.LambdaEdgeEventType
TypeScript (source)aws-cdk-lib » aws_cloudfront » LambdaEdgeEventType

The type of events that a Lambda@Edge function can be invoked in response to.

Example

// A Lambda@Edge function added to default behavior of a Distribution
// and triggered on every request
const myFunc = new cloudfront.experimental.EdgeFunction(this, 'MyFunction', {
  runtime: lambda.Runtime.NODEJS_14_X,
  handler: 'index.handler',
  code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});

declare const myBucket: s3.Bucket;
new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: {
    origin: new origins.S3Origin(myBucket),
    edgeLambdas: [
      {
        functionVersion: myFunc.currentVersion,
        eventType: cloudfront.LambdaEdgeEventType.VIEWER_REQUEST,
      }
    ],
  },
});

Members

NameDescription
ORIGIN_REQUESTThe origin-request specifies the request to the origin location (e.g. S3).
ORIGIN_RESPONSEThe origin-response specifies the response from the origin location (e.g. S3).
VIEWER_REQUESTThe viewer-request specifies the incoming request.
VIEWER_RESPONSEThe viewer-response specifies the outgoing response.

ORIGIN_REQUEST

The origin-request specifies the request to the origin location (e.g. S3).


ORIGIN_RESPONSE

The origin-response specifies the response from the origin location (e.g. S3).


VIEWER_REQUEST

The viewer-request specifies the incoming request.


VIEWER_RESPONSE

The viewer-response specifies the outgoing response.