Skip to content
v2.274.0

LambdaEdgeEventType Enum ​

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

Example ​

ts
// 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_LATEST,
  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 ​

MemberDescription
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.

Referenced by ​