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.184.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86b90f59d31077b32c3acbc789d55d73a2c1fd5a6dbd164bcc2f9f794a6d0747 |
|
MD5 | 6b6d79e899621e5464954acff3274897 |
|
BLAKE2b-256 | 7033ca56a07f84faffa02c8b3ef881a84c395693cb1a7cd61d1cb2ddc03a3014 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.184.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3867bcd935b8fd402bd564e1e0920ef20ab9ac744d5e771f11395aea1975346e |
|
MD5 | 27a8a29f7a693c6386057821cb05c4cb |
|
BLAKE2b-256 | 94dc5142a10cc2aa72138987a1e1ce3ef9ac17af2e65ed97a4e543ab98c047a0 |