Registry / devops / aws-cdk-aws-s3-notifications

aws-cdk-aws-s3-notifications

JSON →
library1.204.0pypypiunverified

AWS CDK construct library that configures S3 bucket event notifications to trigger Lambda functions, SQS queues, and SNS topics. Version 1.204.0 targets AWS CDK v1 (maintenance mode). Released weekly alongside the main CDK.

pip install aws-cdk-aws-s3-notifications==1.204.0
INSTALL
IMPORT
SIG · AWS-CDK-AWS-S3-NOT
A
aws-cdk-aws-s3-notifications
devopspythonv1.204.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

S3EventSource
from aws_cdk.aws_s3_notifications import S3EventSource
from aws_cdk.aws_lambda_event_sources import S3EventSource

Creates an S3 bucket and Lambda function, then adds a notification trigger via LambdaDestination.

from aws_cdk import core, aws_s3 as s3, aws_s3_notifications as s3n, aws_lambda as lambda_ class MyStack(core.Stack): def __init__(self, scope: core.Construct, id: str, **kwargs) -> None: super().__init__(scope, id, **kwargs) bucket = s3.Bucket(self, "MyBucket") fn = lambda_.Function(self, "MyFunction", runtime=lambda_.Runtime.PYTHON_3_9, handler="index.handler", code=lambda_.Code.inline("def handler(event, context): pass")) bucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.LambdaDestination(fn))
Debug
Known issues
deprecatedThis is AWS CDK v1 library. CDK v1 entered maintenance mode on June 1, 2022 and no new features are added. Use aws-cdk-lib (v2) for new projects.
fix
Migrate to CDK v2: use aws-cdk-lib package and import from aws_cdk.aws_s3_notifications (same import path but now part of aws-cdk-lib).
affects: >=1.0.0
gotchaDo not use S3EventSource from aws_s3_notifications. The correct class is S3EventSource from aws_cdk.aws_lambda_event_sources. Using the wrong one causes AttributeError.
fix
Use 'from aws_cdk.aws_lambda_event_sources import S3EventSource'.
affects: all
gotchaThe add_event_notification method enables notifications only for new events. Existing objects are not retroactively notified.
fix
To trigger notifications for existing objects, use S3 Batch Operations or manually copy objects.
affects: all
breakingIn version 1.157.0, the S3 notification constructs were moved from aws-cdk-aws-s3-notifications to aws-cdk-aws-s3. The separate package now only re-exports.
fix
If using CDK v1 >=1.157.0, you can import directly from aws_cdk.aws_s3 instead. The separate package still works.
affects: >=1.157.0
Upgrade
Version history
1.204.0latest on PyPI · released Jun 19, 2023
Audit
Dependencies
aws-cdk-corerequiredCore CDK library
aws-cdk-aws-s3requiredS3 bucket construct
aws-cdk-aws-lambdaoptionalFor Lambda notification destinations
aws-cdk-aws-sqsoptionalFor SQS notification destinations
aws-cdk-aws-snsoptionalFor SNS notification destinations
Agent activity
12 hits · last 30 days
node
8
OpenAI (training)
2
Resources
aws-cdk-aws-s3-notifications — pip install aws-cdk-aws-s3-notifications · libregistry