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.177.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 969e83c35064b8f8b157fad5eb71253dd0a1097703f7db79a78765a709c55340 |
|
MD5 | 53c127839b561750175d89949bfa8a89 |
|
BLAKE2b-256 | 38be0f447c8ab96843285f20c77a2530b7a20485454a59551f9380e6e1502868 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.177.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2a705e411a6ad02be3b4eaa6588d16e5a421ec624a8b2e797d3c5a97d0f3994 |
|
MD5 | 72c5be25a2ebb43f038cf0b74fef4eea |
|
BLAKE2b-256 | c164665b7b19e515f5c6cd2df6af296d40364c7faf9f98e69dbefe6df2be8a1e |