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.167.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25fa6d5bfa73d15c4559dc048205cc93180b1f8fbc785cefd70ab2dcc09d11ec |
|
MD5 | 2a0c68b8b334c3caa23334dd8c396b0e |
|
BLAKE2b-256 | 039b439f404317cd1724d3fcccf2efeb4d8ddd4a77f848906c99d77beedd4bec |
Close
Hashes for aws_cdk.aws_s3_notifications-1.167.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73ea15f0079052fcc9c96af0d03fc330817bcdb2d3c9b2ea9717235bfb564ada |
|
MD5 | 8492ec6213833b0263531b5c61d63527 |
|
BLAKE2b-256 | 167097ef03c68dd19dc47136fa60d4a50ca5d4353fc2e2487c424b8b7e148db8 |