Skip to main content

Bucket Notifications API for AWS S3

Project description

S3 Bucket Notifications Destinations

---

End-of-Support

AWS CDK v1 has reached End-of-Support on 2023-06-01. This package is no longer being updated, and users should migrate to AWS CDK v2.

For more information on how to migrate, see the Migrating to AWS CDK v2 guide.


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.204.0.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for aws-cdk.aws-s3-notifications-1.204.0.tar.gz
Algorithm Hash digest
SHA256 91f66b80ce08b9758c3ce2768bcab24db21a2df1ec9497138cebb9f33daf87f8
MD5 ea78bc5cc807c2740d5745ee4f5f418b
BLAKE2b-256 afd0b6e1af61de836feabfd2a5205a7ecbbeca8c69e1345d60bd5d8905af20b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aws_cdk.aws_s3_notifications-1.204.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b2f9a88497fc2882fdf8e4bfb4262bb896f295b537afe93aa3bc03bdcf1c860
MD5 e21d65a6dbb7477753aa882941129980
BLAKE2b-256 299a5498df16eb20a4463243dce0478593f4865ae38d086300aeba811777c0ae

See more details on using hashes here.

Supported by

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