Skip to main content

Bucket Notifications API for AWS S3

Project description

S3 Bucket Notifications Destinations

---

cdk-constructs: Stable


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

aws-cdk.aws-s3-notifications-1.196.0.tar.gz (30.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file aws-cdk.aws-s3-notifications-1.196.0.tar.gz.

File metadata

File hashes

Hashes for aws-cdk.aws-s3-notifications-1.196.0.tar.gz
Algorithm Hash digest
SHA256 bcb21b64870e9cff29883821b93d2ebb9ea2cf8f54f0a06292343cd8f03d70e1
MD5 fd4887daaae912a85e2b2f4cb5e94c39
BLAKE2b-256 6c222e41cbac258a923f0e77ad2063e4faeeec425a093fcae20f1eda11ab0524

See more details on using hashes here.

File details

Details for the file aws_cdk.aws_s3_notifications-1.196.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_cdk.aws_s3_notifications-1.196.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d5110978c78a25100b115dbd87b574b03500382ed143636d61ec38cdc56960d
MD5 7240a463c5a53adcc58fd44b727bc4c4
BLAKE2b-256 6ae81a33033f80cbe3af9366976bc1aa24ee9d728e3c14566c076172ec7260f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page