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.157.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77e3a02897656bef8c197f9aa34a96bd6a6809fbfb006318176d500b39e756a3 |
|
MD5 | 823ac108875fa5e861df2839b26c0876 |
|
BLAKE2b-256 | 299cac09d569922ea566edb9c9026fe2f0bd0e406960ce6469f9443e78503f02 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.157.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ccb74903dde0d92a803485a2b8d59117af4d98a01f382521bc93f3d0ae719a0 |
|
MD5 | 456e0a90e951ed3aaf0235814f54dec9 |
|
BLAKE2b-256 | 11c4a57372b45e980fce89c7767ef36b7d7e9438de09ac8b553ad042b10f01bd |