AWS SQS AWS.SimpleQueueService.InvalidMessageRetentionPeriod

The message retention period is invalid.

Understanding AWS SQS

Amazon Simple Queue Service (SQS) is a fully managed message queuing service that enables you to decouple and scale microservices, distributed systems, and serverless applications. SQS eliminates the complexity and overhead associated with managing and operating message-oriented middleware, and empowers developers to focus on differentiating work.

For more information, visit the official AWS SQS page.

Identifying the Symptom

When working with AWS SQS, you might encounter the error code AWS.SimpleQueueService.InvalidMessageRetentionPeriod. This error indicates that the message retention period set for your SQS queue is invalid.

What You Observe

Typically, this error is observed when you attempt to create or update an SQS queue with an invalid message retention period. The operation fails, and the error message is returned.

Details About the Issue

The AWS.SimpleQueueService.InvalidMessageRetentionPeriod error occurs when the specified message retention period does not fall within the allowed range. AWS SQS requires the message retention period to be between 60 seconds (1 minute) and 1209600 seconds (14 days).

Why This Happens

This error is typically due to a misconfiguration in the queue settings, where the retention period is set outside the permissible range. This could be a result of a typo, incorrect configuration script, or misunderstanding of the allowed values.

Steps to Fix the Issue

To resolve the AWS.SimpleQueueService.InvalidMessageRetentionPeriod error, follow these steps:

Step 1: Verify Current Configuration

Check the current message retention period setting for your SQS queue. You can do this via the AWS Management Console, AWS CLI, or AWS SDKs.

aws sqs get-queue-attributes --queue-url --attribute-names MessageRetentionPeriod

Step 2: Update the Message Retention Period

If the retention period is outside the valid range, update it to a valid value. Use the AWS CLI command below to set a new retention period:

aws sqs set-queue-attributes --queue-url --attributes MessageRetentionPeriod=

Ensure that the <valid-period-in-seconds> is between 60 and 1209600.

Step 3: Confirm the Changes

After updating, confirm that the changes have been applied successfully by retrieving the queue attributes again:

aws sqs get-queue-attributes --queue-url --attribute-names MessageRetentionPeriod

Verify that the MessageRetentionPeriod is now set to a valid value.

Additional Resources

For more detailed guidance on configuring SQS queues, refer to the AWS SQS Developer Guide.

If you continue to experience issues, consider reaching out to AWS Support for further assistance.

Never debug

AWS SQS

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
AWS SQS
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid