| Did this page help you? Yes No Tell us about it... |
Amazon SQS message timers allow you to specify an initial invisibility period for a message that you are adding to a queue. For example, if you send a message with the DelaySeconds parameter set to 45, the message will not be visible to consumers for the first 45 seconds that the message resides in the queue. The default value for DelaySeconds is 0.
To set a delay period that applies to all messages in a queue, use delay queues. For more information, see Amazon SQS Delay Queues. A message timer setting for an individual message overrides any DelaySeconds value that applies to the entire delay queue.
To send a message with a message timer using the AWS Management Console
Sign in to the AWS Management Console and open the Amazon SQS console at https://console.aws.amazon.com/sqs/.
Select a queue.

Select Send a Message from the Queue Actions drop-down list.
![]() | Note |
|---|---|
The Queue Actions drop-down list is available only if a queue is selected. |

In the Send a Message to MyQueue dialog box, enter a message (e.g., This is a test message with a message timer.).

Enter a delay value (e.g., 30) in the Delay delivery of this message by text box.

Click Send Message.
In the Send a Message to MyQueue confirmation box click Close.

The following Query API example applies a 45 second initial visibility delay for a single message sent with SendMessage.
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/ ?Action=SendMessage &MessageBody=This+is+a+test+message &Attribute.Name=DelaySeconds &Attribute.Value=45 &Version=2011-10-01 &SignatureMethod=HmacSHA256 &Expires=2011-10-18T22%3A52%3A43PST &AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE &SignatureVersion=2 &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE
You can also use the Query API SendMessageBatch action to send up to ten messages with message timers. You can assign a different DelaySeconds value to each message or assign no value at all. If you do not set a value for DelaySeconds, the message might still be subject to a delay if you are adding the message to a delay queue. For more information about delay queues, see Amazon SQS Delay Queues. The following example uses SendMessageBatch to send three messages: one message without a message timer and two messages with different values for DelaySeconds.
http://sqs.us-east-1.amazonaws.com/123456789012/testQueue/ ?Action=SendMessageBatch &SendMessageBatchRequestEntry.1.Id=test_msg_no_message_timer &SendMessageBatchRequestEntry.1.MessageBody=test%20message%20body%201 &SendMessageBatchRequestEntry.2.Id=test_msg_delay_45_seconds &SendMessageBatchRequestEntry.2.MessageBody=test%20message%20body%202 &SendMessageBatchRequestEntry.2.DelaySeconds=45 &SendMessageBatchRequestEntry.3.Id=test_msg_delay_2_minutes &SendMessageBatchRequestEntry.3.MessageBody=test%20message%20body%203 &SendMessageBatchRequestEntry.3.DelaySeconds=120 &Version=2011-10-01 &SignatureMethod=HmacSHA256 &Expires=2011-10-18T22%3A52%3A43PST &AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE &SignatureVersion=2 &Signature=Dqlp3Sd6ljTUA9Uf6SGtEExwUQEXAMPLE