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.164.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9b1bf897e9b1bc4b3cc4c766ccc068d6e740f7b8ad38bebe4dc88ac99759582 |
|
MD5 | a1c6e366217a97439aba5382cddf0ba0 |
|
BLAKE2b-256 | ae01a95e6501f442f5df8800e6c0714df8c527d98ae977e2621847203444539e |
Close
Hashes for aws_cdk.aws_s3_notifications-1.164.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9a6b3444a9f8bb4fb7395f345b9fd7def7c7d7f3fdf1342b964a97632b8abb5 |
|
MD5 | b0aa6b88a7a808cc412e68d57c344687 |
|
BLAKE2b-256 | f96d6f59f0c30d4f4c10be2d6abf012015c37e6c4607d9f7b0c3829183a8e747 |