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.158.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a78d7b6d8bf8e10939ec3e4730a5b16f2fd5435ed603483f0f5773dbda354dd9 |
|
MD5 | 418be2730708043ea661511144879364 |
|
BLAKE2b-256 | 4c59dc86d84203a0189d3abe22f07fb53f549ff974f8754051a323f269710a74 |
Close
Hashes for aws_cdk.aws_s3_notifications-1.158.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bf936642dfb267ae4c0e42cf6455e8ea08bd6baeb6fbeb95d8d9d6501cf035b |
|
MD5 | 11c1bfbce8e86a212489a9f1d2a272c3 |
|
BLAKE2b-256 | 562b44f04dea8ce3f8d67d7b2ff4d3df1d2a83fd38de7c57ac9f4e182296ab11 |