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.154.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44a1ada42788dafbb472e9c24b2bd09540354fa0ae3c8f0d4dcf1be71bd1f060 |
|
MD5 | 09434b899a83883b557dd277d6044ba1 |
|
BLAKE2b-256 | fe2f01a945764decd105134db34449f45a5555883633b6aef6c4cbca15c7a200 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.154.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af1201245a0f47a6679c5876bef9b3fd2c90c5774680ec9405f345fd47879685 |
|
MD5 | dde64f8559edf62f7f80430edcf6c35d |
|
BLAKE2b-256 | 038417cdaf357823f1f93fff1a36b0b3cbe97eb6d2b91ba08c28f81d851849f5 |