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.196.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcb21b64870e9cff29883821b93d2ebb9ea2cf8f54f0a06292343cd8f03d70e1 |
|
MD5 | fd4887daaae912a85e2b2f4cb5e94c39 |
|
BLAKE2b-256 | 6c222e41cbac258a923f0e77ad2063e4faeeec425a093fcae20f1eda11ab0524 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.196.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d5110978c78a25100b115dbd87b574b03500382ed143636d61ec38cdc56960d |
|
MD5 | 7240a463c5a53adcc58fd44b727bc4c4 |
|
BLAKE2b-256 | 6ae81a33033f80cbe3af9366976bc1aa24ee9d728e3c14566c076172ec7260f0 |