What is the better way of notifying my spring boot backend that an object has been stored into an AWS S3 bucket

25 Views Asked by At

I am currently trying to develop a "social media like" app as a personal project (to learn more) I am currently designing the way my object storage will notify that an object has been successfully stored...

I can think of two ways of notifying my spring boot backend that my object was successfully stored into my bucket :

  • Via the response of the request to the presigned link, the client notifies the success to the backend
  • Via an AWS lambda function called once an object is stored that will request to my backend

I don't know what is better and would like to know more about the pros and cons of the two methods I proposed

1

There are 1 best solutions below

0
John Rotenstein On

An Amazon S3 event can be triggered when an object is created in a bucket. It can:

  • Send a message to an Amazon SQS Queue and your app could poll the queue, or
  • Trigger an AWS Lambda function, which can run whatever code you want -- but the question then is how it will 'call' your backend, or
  • Send a message to an Amazon SNS Topic which in turn can:
    • Call an HTTP/S endpoint (a good way of triggering a web app!)
    • And do other things not relevant for your use-case, such as send an email or an SMS

I'd recommend either polling SQS or receiving an HTTP/S message.