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.156.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e912b7891e6546fa75d79f61f8f76a38dad0ff789ca9dea8f10b21c11f45906f |
|
MD5 | 16986733850329c97c36b91c8178c9d5 |
|
BLAKE2b-256 | 576863c8fbf0b16ff70fca853ad4bcda9811f20b1ba2f15b6a15a85f307203e7 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.156.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee4dd6920d9730926767eb3e2569903fc81f0ddd2ac0960da633181329636426 |
|
MD5 | ed8786216538694c89f328f0a202172d |
|
BLAKE2b-256 | a4b477a5eb283e2cf11527a55b432613a98e94243c94a2019fec7ea485c31f4b |