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.170.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4110172c6b14061a0165cd033d7db4649d3f478645d590537ba060fd1605bc04 |
|
MD5 | b75fe04b60784bae7d99b32166d4a508 |
|
BLAKE2b-256 | a3541757299c975581fad442f4b0ec71e8024fadac8a5393af18459891b0368f |
Close
Hashes for aws_cdk.aws_s3_notifications-1.170.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a46059d3b5dc565a3ff0102833009960c3ac313f0403f547dee5e136ea0e6318 |
|
MD5 | 9509775f3059cd848a9707f3932c7f46 |
|
BLAKE2b-256 | f699a4d99eeca7cde147d417002c0cf7a480e4424e24ef577d79932ae4d2c72e |