See: Description
| Class | Description |
|---|---|
| LambdaDestination |
(experimental) Use a Lambda function as a bucket notification destination.
|
| SnsDestination |
(experimental) Use an SNS topic as a bucket notification destination.
|
| SqsDestination |
(experimental) Use an SQS queue as a bucket notification destination.
|
This module includes integration classes for using Topics, Queues or Lambdas as S3 Notification Destinations.
The following example shows how to send a notification to an SNS topic when an object is created in an S3 bucket:
// Example automatically generated from non-compiling source. May contain errors. import software.amazon.awscdk.core.*; Bucket bucket = new Bucket(stack, "Bucket"); Topic topic = new Topic(stack, "Topic"); bucket.addEventNotification(EventType.OBJECT_CREATED_PUT, new SnsDestination(topic));
The following example shows how to send a notification to a Lambda function when an object is created in an S3 bucket:
// Example automatically generated from non-compiling source. May contain errors.
import software.amazon.awscdk.core.*;
Bucket bucket = new Bucket(stack, "Bucket");
Function fn = new Function(this, "MyFunction", Map.of(
"runtime", Runtime.getNODEJS_12_X(),
"handler", "index.handler",
"code", Code.fromAsset(path.join(__dirname, "lambda-handler"))));
bucket.addEventNotification(EventType.OBJECT_CREATED, new LambdaDestination(fn));
Copyright © 2022. All rights reserved.