@Stability(value=Stable)
See: Description
| Class | Description |
|---|---|
| LambdaDestination |
Use a Lambda function as a bucket notification destination.
|
| SnsDestination |
Use an SNS topic as a bucket notification destination.
|
| SqsDestination |
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 without compilation. See https://github.com/aws/jsii/issues/826 import software.amazon.awscdk.services.s3.notifications.*; Object bucket = new Bucket(stack, "Bucket"); Object topic = new Topic(stack, "Topic"); bucket.addEventNotification(s3.EventType.getOBJECT_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 without compilation. See https://github.com/aws/jsii/issues/826
import software.amazon.awscdk.services.s3.notifications.*;
Object 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(s3.EventType.getOBJECT_CREATED(), new LambdaDestination(fn));
Copyright © 2021. All rights reserved.