# S3 Bucket Notifications Destinations
<!--BEGIN STABILITY BANNER-->---
![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)
> 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](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).
---
<!--END STABILITY BANNER-->
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:
```python
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:
```python
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:
```python
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))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/aws/aws-cdk",
"name": "aws-cdk.aws-s3-notifications",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Amazon Web Services",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/af/d0/b6e1af61de836feabfd2a5205a7ecbbeca8c69e1345d60bd5d8905af20b6/aws-cdk.aws-s3-notifications-1.204.0.tar.gz",
"platform": null,
"description": "# S3 Bucket Notifications Destinations\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![End-of-Support](https://img.shields.io/badge/End--of--Support-critical.svg?style=for-the-badge)\n\n> AWS CDK v1 has reached End-of-Support on 2023-06-01.\n> This package is no longer being updated, and users should migrate to AWS CDK v2.\n>\n> For more information on how to migrate, see the [*Migrating to AWS CDK v2* guide](https://docs.aws.amazon.com/cdk/v2/guide/migrating-v2.html).\n\n---\n<!--END STABILITY BANNER-->\n\nThis module includes integration classes for using Topics, Queues or Lambdas\nas S3 Notification Destinations.\n\n## Examples\n\nThe following example shows how to send a notification to an SNS\ntopic when an object is created in an S3 bucket:\n\n```python\nimport aws_cdk.aws_sns as sns\n\n\nbucket = s3.Bucket(self, \"Bucket\")\ntopic = sns.Topic(self, \"Topic\")\n\nbucket.add_event_notification(s3.EventType.OBJECT_CREATED_PUT, s3n.SnsDestination(topic))\n```\n\nThe following example shows how to send a notification to an SQS queue\nwhen an object is created in an S3 bucket:\n\n```python\nimport aws_cdk.aws_sqs as sqs\n\n\nbucket = s3.Bucket(self, \"Bucket\")\nqueue = sqs.Queue(self, \"Queue\")\n\nbucket.add_event_notification(s3.EventType.OBJECT_CREATED_PUT, s3n.SqsDestination(queue))\n```\n\nThe following example shows how to send a notification to a Lambda function when an object is created in an S3 bucket:\n\n```python\nimport aws_cdk.aws_lambda as lambda_\n\n\nbucket = s3.Bucket(self, \"Bucket\")\nfn = lambda_.Function(self, \"MyFunction\",\n runtime=lambda_.Runtime.NODEJS_14_X,\n handler=\"index.handler\",\n code=lambda_.Code.from_asset(path.join(__dirname, \"lambda-handler\"))\n)\n\nbucket.add_event_notification(s3.EventType.OBJECT_CREATED, s3n.LambdaDestination(fn))\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Bucket Notifications API for AWS S3",
"version": "1.204.0",
"project_urls": {
"Homepage": "https://github.com/aws/aws-cdk",
"Source": "https://github.com/aws/aws-cdk.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "299a5498df16eb20a4463243dce0478593f4865ae38d086300aeba811777c0ae",
"md5": "e21d65a6dbb7477753aa882941129980",
"sha256": "4b2f9a88497fc2882fdf8e4bfb4262bb896f295b537afe93aa3bc03bdcf1c860"
},
"downloads": -1,
"filename": "aws_cdk.aws_s3_notifications-1.204.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e21d65a6dbb7477753aa882941129980",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.7",
"size": 29941,
"upload_time": "2023-06-19T21:01:00",
"upload_time_iso_8601": "2023-06-19T21:01:00.839534Z",
"url": "https://files.pythonhosted.org/packages/29/9a/5498df16eb20a4463243dce0478593f4865ae38d086300aeba811777c0ae/aws_cdk.aws_s3_notifications-1.204.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "afd0b6e1af61de836feabfd2a5205a7ecbbeca8c69e1345d60bd5d8905af20b6",
"md5": "ea78bc5cc807c2740d5745ee4f5f418b",
"sha256": "91f66b80ce08b9758c3ce2768bcab24db21a2df1ec9497138cebb9f33daf87f8"
},
"downloads": -1,
"filename": "aws-cdk.aws-s3-notifications-1.204.0.tar.gz",
"has_sig": false,
"md5_digest": "ea78bc5cc807c2740d5745ee4f5f418b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.7",
"size": 30589,
"upload_time": "2023-06-19T21:07:11",
"upload_time_iso_8601": "2023-06-19T21:07:11.771718Z",
"url": "https://files.pythonhosted.org/packages/af/d0/b6e1af61de836feabfd2a5205a7ecbbeca8c69e1345d60bd5d8905af20b6/aws-cdk.aws-s3-notifications-1.204.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-19 21:07:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aws",
"github_project": "aws-cdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aws-cdk.aws-s3-notifications"
}