Other Articles

SQS Queue – Monitor Message Age

This check ensures that the age of messages in Amazon SQS queues is monitored. Monitoring message age helps identify processing delays and prevents messages from remaining unprocessed for extended periods.

Check Details

  • Resource: SQS Queue
  • Check: Monitor SQS message age
  • Risk: Delayed processing or message loss due to long retention periods

Remediation via AWS Console

  1. Log in to the AWS Management Console and open the Amazon SQS console. Amazon SQS Console
  2. Click Queues and select the required SQS queue. SQS queues list
  3. Open the Monitoring tab and verify that the metric ApproximateAgeOfOldestMessage is available and updating. SQS message age metric
  4. If the metric is not present or messages are retained too long, click Edit.
  5. Under Details, configure the Message retention period to 4 days (345600 seconds) or higher. SQS retention period
  6. Click Save changes.
  7. Repeat these steps for all SQS queues.

Remediation via AWS CLI

  1. Log in to the AWS Management Console and click the CloudShell icon (>_) in the top-right corner. AWS CloudShell
  2. List all SQS queues:
    
    
    aws sqs list-queues
    
  3. Verify queue attributes:
    
    
    aws sqs get-queue-attributes \
     --queue-url <queue-url> \
     --attribute-names All
    
    SQS queue attributes
  4. Set the message retention period to 4 days:
    
    
    aws sqs set-queue-attributes \
     --queue-url <queue-url> \
     --attributes MessageRetentionPeriod=345600