Open In App

Amazon Web Services – Amazon S3 Notifications to SNS

Last Updated : 27 Mar, 2023
Like Article

In this article, we will see how the Amazon S3 bucket publishes notifications to SNS topics on object creation events. An object that creates an event is of four types. They are Put, Post, Copy, Multipart Upload, Remove, Replicate and Restore. Thus, whenever any of the event occur in our S3 bucket, it will publish a notification to a topic and the subscribers to that topic can view those messages.


  1. Create an SNS topic, say, GeeksTopic.
  2. Create subscribers under the topic.
  3. Create an S3 bucket, say, geeksforgeeks.
  4. Create event notifications under that bucket and configure them to the created topic.
  5. Upload object in the bucket.
  6. View message received by the subscriber.

The above approach has been implemented below.

  • Creation of SNS topic: SNS topic could be of two types, FIFO (First in First Out) and Standard. We will choose a standard for now and give the name as GeeksTopic. We will keep the encryption of messages disabled. Under access policy, by default only the owner is allowed to publish messages to the topic, not even the AWS services are allowed. Therefore, we select Basic and can opt either Everyone or Only the specified AWS accounts (need to specify the AWS account number). We will go for everyone and keep the rest of the settings as default and create the topic. See the below images:

  • Create Subscriber to Topic: A subscriber can subscribe to the topic in many ways. Some of the ways are Email, SMS, HTTPS, etc. We will select the email in this demo and under the endpoint will specify the email to which we want to receive messages. Leave the rest of the settings as default and create a subscriber. Once the subscriber is created, confirm the subscription to the topic by email received on your email id. See the below images:

  • Create a Bucket: Create a bucket in which when an object creates an event occurs, it should trigger an event and publish a notification to the topic. See the below image:

  • Create Event Configuration: To create events, go to the properties of the bucket and click on create event notifications tab. Specify the event name, say, geekseventtest, select event type as All object create event and under destination, select SNS Topic and choose the topic GeeksTopic. Click save changes. Once the event is created, you will receive an email stating TestEvent, thus confirming your subscription to the topic. See the below images:

  • Upload Object: Upload an object in the bucket to trigger an event. The event type will be of Put type as you are putting the object into the bucket.
  • Confirm event notification – As soon as the object is uploaded, an event is triggered, and it publishes the messages to the topic to which event has been configured. In our case GeeksTopic. To confirm, view the message received in the email. See the below image:

We have successfully configured an event to SNS and are able to view messages through subscribers.

Similar Reads

Amazon Web Services - Configuring Amazon S3 Event Notifications
The Amazon S3 notification feature enables you to receive notifications when a certain event occurs inside your bucket. To get notifications, first, add a notification configuration that reads the event you want Amazon S3 to publish and the destinations where Amazon S3 will send the notifications. This configuration is stored in the notification su
5 min read
AWS (Amazon Web Services) SNS VS SQS
Are you confused between the AWS SNS and AWS SQS? If yes, here is the best guide to help you. This insightful article covers complete details on the comparison between the AWS SNS and AWS SQS. By the end of this guide, you will be able to easily find what AWS Tool is best suited for your business. IntroductionThe messaging service plays an importan
8 min read
Machine Learing (ML) Services Offered By Amazon Web Services (AWS)
In today's rapidly evolving technologies, harnessing the power of cloud computing has become imperative for businesses striving to stay ahead. Among the many cloud computing platforms, AWS is the most used cloud computing platform. In this guide, I will make sure that you will understand what is AWS and why cloud computing services are important to
10 min read
How To Install AWS CLI - Amazon Simple Notification Service (SNS)?
Amazon Simple Notification Service (SNS) is used for the Application to Application (A2A) and Application to Person (A2P) communication. It provides developers with a highly scalable, flexible, and cost-effective capability to publish messages from an application and immediately deliver them to subscribers or other applications. Using AWS Console i
2 min read
How to Create, Push, and Delete Topics in Amazon SNS with PHP?
Amazon SNS is an asynchronous message-passing system that solves the drawback above. The sender is called publisher whereas the receiver is called subscriber. The main advantage of pub-sub is that it decouples the subsystem which means all the components can work independently.AWS Credentials(AWS access key ID & AWS secret key): You need to be
5 min read
When it comes to developing software, Amazon Web Services (AWS) corresponds to a developer's dream toolkit. It assists in the development of dependable, high-performing apps that can manage heavy workloads. Amazon Simple Notification Service (SNS) and Amazon Simple Queue Service (SQS) are two of the many services that AWS provides. These tools, whi
12 min read
Simple Notification Service (SNS) in AWS
Amazon Web Services Simple Notification Service (AWS SNS) is a web service that automates the process of sending notifications to the subscribers attached to it. SNS provides this service to both application-to-person and application-to-application. It uses the publishers/subscribers paradigm for the push and delivery of messages. The data loss is
6 min read
Difference Between SNS And Kafka
AWS SNS and Apache Kafka are two distinct representative components that work for the same functionality of modern communication and data processing. AWS SNS are online communities that facilitate the sharing of content creations. Instagram, Twitter, and Facebook are a few well-known for this service AWS SNS usage. Apache Kafka is first introduced
6 min read
How To Create SNS Topic In AWS In Using Terraform
Amazon Simple Notification Service (SNS) is a fully managed messaging service given by Amazon Web Services (AWS), offering a versatile and reliable solution for sending notices and messages to different endpoints or subscribers. SNS points act as correspondence channels to which messages can be distributed and dispersed to numerous subscribers, inc
6 min read
Creating SNS And SQS Using Terraform
Terraform, is an open-source and specific infrastructure as a code (IaC) tool developed by HashiCorp. that helps the Terraform users to build, change, and version their infrastructure in the most secure and efficient way. using terraform, users can manage resources such as virtual machines, storage, and network through infrastructure provisioning a
14 min read