Bucket Notifications API for AWS S3
Project description
S3 Bucket Notifications Destinations
---This module includes integration classes for using Topics, Queues or Lambdas as S3 Notification Destinations.
Examples
The following example shows how to send a notification to an SNS topic when an object is created in an S3 bucket:
import aws_cdk.aws_sns as sns
bucket = s3.Bucket(self, "Bucket")
topic = sns.Topic(self, "Topic")
bucket.add_event_notification(s3.EventType.OBJECT_CREATED_PUT, s3n.SnsDestination(topic))
The following example shows how to send a notification to an SQS queue when an object is created in an S3 bucket:
import aws_cdk.aws_sqs as sqs
bucket = s3.Bucket(self, "Bucket")
queue = sqs.Queue(self, "Queue")
bucket.add_event_notification(s3.EventType.OBJECT_CREATED_PUT, s3n.SqsDestination(queue))
The following example shows how to send a notification to a Lambda function when an object is created in an S3 bucket:
import aws_cdk.aws_lambda as lambda_
bucket = s3.Bucket(self, "Bucket")
fn = lambda_.Function(self, "MyFunction",
runtime=lambda_.Runtime.NODEJS_14_X,
handler="index.handler",
code=lambda_.Code.from_asset(path.join(__dirname, "lambda-handler"))
)
bucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.LambdaDestination(fn))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for aws-cdk.aws-s3-notifications-1.179.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e99bd8e30eb68803c24a03122666baca9b874be1687451d4b8f2b4001b709f16 |
|
MD5 | 863fcdabda735ee3bb788e455492209b |
|
BLAKE2b-256 | fcd95cae4db744f5c57e00d762f13b664b9be381fd7511eb26e7fb87b704e351 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.179.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f839db361cb4b4d7d6b6fab22731046df22063903b749a4e9b5f53e676349c4 |
|
MD5 | 0770ae1d0b7812d03bb1edc2a6919cb1 |
|
BLAKE2b-256 | c2291d5db5405ee5cf00aa07948f5fe95ec180f9418369b60cc7f86f8c221369 |