Skip to content

Instantly share code, notes, and snippets.

@dkhmelenko
Last active October 12, 2021 21:19
Show Gist options
  • Save dkhmelenko/4e229f813e89e9ec949b550747599e8e to your computer and use it in GitHub Desktop.
Save dkhmelenko/4e229f813e89e9ec949b550747599e8e to your computer and use it in GitHub Desktop.
AWS CDK example
from aws_cdk import (aws_s3, aws_s3_notifications, core, aws_sns)
# create S3 bucket
s3 = aws_s3.Bucket(self, "s3bucket_cdk")
# define SNS topic ans assign it
sns_topic = aws_sns.Topic(self, "CDK Notification")
sns_notification = aws_s3_notifications.SnsDestination(sns_topic)
# assign notification for the s3 event type when new object created
s3.add_event_notification(aws_s3.EventType.OBJECT_CREATED, sns_notification)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment