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.162.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ab88baa907d52f334c49a3ac5d14c8b775b13fd92f95d30477d67076142e1df |
|
MD5 | 5f6911cc7f39dde00a26ba8edf829ea7 |
|
BLAKE2b-256 | 8d95c29b4f9e058455303813fc84e1e6ab90752fee83007695a2dfea33f15348 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.162.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ba110ad2d2bd8a150b028d2492d0adad7cefa6fd9634426354a187260318d0 |
|
MD5 | 35ffed75eee5d322355722360e698a63 |
|
BLAKE2b-256 | 317609c946e4d1275e571b1ac30789fa789b07dbdab8e36e1c9bd945bab7f92c |