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.175.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 717a5149f8dc0ff368e780180b006dc4e31bf8a0f0f49e9e4ce6c8719e609122 |
|
MD5 | defc6121e014fde4a5b3fe4f6a41bd4d |
|
BLAKE2b-256 | c1a8f83ecd7118a847c16a01ef69087cdb31a1a4c67a80069b379bb3cba75ab7 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.175.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e71640ab3528fdbd0e7cb92d308ce575caefd586f7432e92fefe3e6b1d121c39 |
|
MD5 | 9af51865ec38d3be5014d4ca2dc67366 |
|
BLAKE2b-256 | 02eb11ee080b9e126be9589b58a12091baed5148c2f6af59cda38a7dcc1b810d |