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.161.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 675c2552bc8a5d87962168ed5c51141cf0fb037330a45f5a9164f69800fba4ec |
|
MD5 | 58c09d4651fcd23209cdab7df360754a |
|
BLAKE2b-256 | 2eeee805b3d16552aec17662c2f6c7c6597e1e8e35e71966a667aef65c6f0d1d |
Close
Hashes for aws_cdk.aws_s3_notifications-1.161.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 194d39106d002468c1507992d8bcef3536d749f7d98847dc68f9cf9d2af4e186 |
|
MD5 | e7a6a5c4347b5c9d1fa156a5c00e44f4 |
|
BLAKE2b-256 | 6054c44c0e3ac2aeb279f8a5cf9b8ab018ba58b022fa953a9d8d5b607b40b3a6 |