S3 events notifications supports standard SNS topics and standard SQS queues as destinations but don’t support SNS FIFO and SQS FIFO.
S3 events notifications enables you to be notified whenever a specific event happens in your bucket. To receive the notification you must define the events you are interested in and the destination. The notifications are usually triggered in seconds but sometimes can take longer.
The events are –
New object creation
Object removal (versioned and non-versioned objects)
Object restore (e.g from Glacier)
Object lost on a reduced redundancy storage
The possible destinations include –
SQS – as mentioned above standard queues only and not FIFO queues
SNS- as mentioned above standard topics only and not FIFO topics
If when processing the events you write back to S3 be careful not to create an execution loop
While, SQS FIFO queues were introduced in 2016, SNS FIFO capabilities were introduced only on October 2020.
This capability is important for cases in which the order matters. E.g. bank transactions were you commit a transaction only if the balance remains non-negative.
Messages are grouped and ordered according to the message group ID. When sending a message you must specify a message group ID otherwise the action fails. If all the messages have the same message group ID then all the messages are sent and received in strict order. The message group id can be any value, e.g 12, “hello”, “user_id-123”, etc.
Note that as in the SQS case, the topic name must end with .fifo, a limitation that counts to the 80 characters restriction as well.
This means that all the messages which are pushed to this queue would be visible to the consumer after the delay period. The minimum delay which is also the default delay is 0 and the maximum is 15 minutes.
Note that when changing the delay of a queue the behaviour of FIFO queues and standard queues is different –
For standard queues, the per-queue delay setting is not retroactive—changing the setting doesn’t affect the delay of messages already in the queue.
For FIFO queues, the per-queue delay setting is retroactive—changing the setting affects the delay of messages already in the queue.
If you need to delay the visibility of specific messages and not all messages in the queue you can use message timers and add an initial invisibility period for a message. This is only supported by standard queues.Note that setting a message timer for individual messages overrides the delay period of the delay queue.
See the image below to understand message timeline in a queue –