For every object removal from the S3 Bucket, the SNS Topic Subscription will send an email notification. Once the stack is deployed it will send an email confirmation to subscribe to the SNS topic. After subscribing to the SNS topic, you will receive an email notification for every object removal from the S3 Bucket. When naming the bucket, it must be unique globally. If you get the "Bucket name already exists"
error, you must use a different bucket name to create the bucket.
NOTE: Update the EmailSubscription
endpoint on the s3-sns-stack.ts file.
- Amazon SNS FAQs
- Amazon S3 Event Notifications
- Bucket restrictions and limitations
- Event notification types and destinations
- Supported event types for SQS, SNS, and Lambda
- Tutorial: Send a notification when an Amazon S3 object is created
- Walkthrough: Configuring a bucket for notifications (SNS topic or SQS queue)
- How can I resolve the "Bucket name already exists" or "BucketAlreadyExists" error from Amazon S3?
The cdk.json
file tells the CDK Toolkit how to execute your app.
npm install
install projects dependenciesnpm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation templatecdk bootstrap
deployment of AWS CloudFormation template to a specific AWS environment (account and region)cdk destroy
destroy this stack from your default AWS account/region
-
Install all the dependencies, bootstrap your project, and synthesized CloudFormation template.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/s3/s3-sns$ make init # With "profile" parameter dev@dev:~:aws-cdk-samples/s3/s3-sns$ make init profile=[profile_name]
-
Deploy the project.
# Without passing "profile" parameter dev@dev:~:aws-cdk-samples/s3/s3-sns$ make deploy # With "profile" parameter dev@dev:~:aws-cdk-samples/s3/s3-sns$ make deploy profile=[profile_name]