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_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

aws-cdk.aws-s3-notifications-1.166.1.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

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

aws_cdk.aws_s3_notifications-1.166.1-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for aws-cdk.aws-s3-notifications-1.166.1.tar.gz
Algorithm Hash digest
SHA256 b59e7f229a89406cdac97b98fcaf5bf0ad467a25a048847f4ab8b023d2a651b0
MD5 44e466b83efca2ea863ec0f169900f74
BLAKE2b-256 fb129a0f3ebbf8ddc257a2def690a50dbf7b66e0859df9f36b93681a816bd08e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aws_cdk.aws_s3_notifications-1.166.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3a97de57fd2ac87677706c59a80adaa288fe02ae6674aa0ffce6c7715848a0c4
MD5 41820e7fb03f815ef1b154a698837c64
BLAKE2b-256 52d0a22623b7eca0cc971e7774eece4b3b66fe01a2683b3f5e1da31dd9a19249

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