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.189.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | be6f62523a7f91c9c9ac1b427c59cb8a82a57fda6c6832f592a46c7ec3900fc7 |
|
MD5 | 08bea3fc442e5285f2a13eb523cd588b |
|
BLAKE2b-256 | 355b28424372e70d3e3f9d6d377d64ee00b8f25b0d5f74b74e8993e3f157840c |
Close
Hashes for aws_cdk.aws_s3_notifications-1.189.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa298b0ded4251fe3d98c36638f6e2faf957e3ac976e7f0e3e38ca51a00e260 |
|
MD5 | 4463ec03955247ccf5ed8786a91341c2 |
|
BLAKE2b-256 | 24a53e5367a82d87bdb707eac46e62a5f5b54ba4852382e32c118de9ae4b51cc |