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.186.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bef6499179f74a85cdd92a65ad4149fa0ba1f8e027430fd76294adc6b1e6562c |
|
MD5 | 35cd7a2ab5fa8541a397a24a0f3658c0 |
|
BLAKE2b-256 | 36e6e74f28ee92c238f91c93ff876c3344e996c48a123373945665f6c15a366a |
Close
Hashes for aws_cdk.aws_s3_notifications-1.186.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 638ff53bfbee2ba8ff4b157788362e1f94d2a5737a646269b73c2ef14e20c7e3 |
|
MD5 | 4bef04c90d37a6fdf086ac03bfe5c29b |
|
BLAKE2b-256 | 6939b8ef7e0fd869556a9f221ed88cbf80dfaea80b415a857a7c3ab424b8e595 |