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.163.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44270412624b05c9332e499b2a71711245216b37703762df0494925c67a600ed |
|
MD5 | 1f95c4ec6bba16ed26a19a1de5f0bc9a |
|
BLAKE2b-256 | dd5658f921ca8247ed4a535f666a768d939fb187bb2af8b68675e4e46c55b43a |
Close
Hashes for aws_cdk.aws_s3_notifications-1.163.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ca269fd9230586e0bc4bbdb58876b3ccd9bcb32347ae634f97bbe4d85e54999 |
|
MD5 | 90a01cbf6322246e020cac39616f2b77 |
|
BLAKE2b-256 | b6b21a742136379720a456b8c2e0d92444a3ff5c02e4b9e102fcd3e0cab64814 |