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.163.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 491e31a566b019d800aabfb2d470d43bd5d99ff9ceb2d7fb9433f13d28c85c66 |
|
MD5 | 14cb5b8cdfaf5454461c7fd65c6bd4c9 |
|
BLAKE2b-256 | ec982bf73d93014b99d6ef9b8e67c9e17ff6ed64db2e3700e260449f109bf583 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.163.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c493b17d017d3145c3bf4479a9b41d3c345447c6e505612bdf4502cab3601d71 |
|
MD5 | c9a46ba9b9d1d747c8346b1998fd0dae |
|
BLAKE2b-256 | ca0a606331804a86f68d3df6cd579a5388e5638bbc534849e0e3a6d307f28c73 |