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_14_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.193.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36fdaead42a516688c692d8456a5537c5557d5b0b3164b87cf37088f6ccba15c |
|
MD5 | 8f1c6542d09a5172edfa0a6dab10fd3c |
|
BLAKE2b-256 | f90bbfee4940004661d6a5d01501531a3e42d9dac3f67d24bd7dd565455ba07f |
Close
Hashes for aws_cdk.aws_s3_notifications-1.193.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de2d3a15a7643557c7ea2f15c6ada2306759c66ed8e476326061e3e8a5a67f0a |
|
MD5 | 0d6e5a1e66c4c8d3ba56314fc9541e7d |
|
BLAKE2b-256 | a58b0b08eed5a58aba7d347b58de8463542e1febfd34735876edb277797937a8 |