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_12_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.147.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 410551b82f4ef9ea28d716a75ccc177e4bf3c31fadfc53427a8b863c9fe4191d |
|
MD5 | 55a1bdcac13b129e4c1881acbbe6a6bd |
|
BLAKE2b-256 | 80ae17e4fcfa4bd5facda93a134e494cfe8cc839fde95485052d473b5a125913 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.147.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9d47664717734a30f233847ef4a46ccff867887834e97469a9eaeded0e64c8a |
|
MD5 | c02e3b591311d0a87c980aa3257d58c0 |
|
BLAKE2b-256 | 8a1a9d8b73ef0c0e02c0fb5f67e3238d9243eb912c21c03879420343aebfd25a |