Why are my Amazon SQS charges higher than expected?

Last updated: 2021-07-23

I was billed a higher charge for Amazon Simple Queue Service (Amazon SQS) than I was expecting based on my usage.


I’m hitting the Amazon SQS free tier limit, but I only sent a few messages during the billing period.

How can I better understand Amazon SQS charges, and how can I reduce Amazon SQS costs?

Short description

The most common cause for a high number of SQS requests are empty receives, which are billed as ReceiveMessage requests that don’t return a message. Amazon SQS charges are based on request volume and data transferred in and out of Amazon SQS. A consumer polling an SQS queue continuously results in empty receives. These empty receives are charged per Amazon SQS pricing even if messages aren’t sent or received from your SQS queue.


Review the NumberOfEmptyReceives CloudWatch metric

To determine if empty receives are contributing to high Amazon SQS charges, review the Amazon CloudWatch NumberOfEmptyReceives metric for the SQS queue. A high number of empty receives indicates that a consumer is making a high number of ReceiveMessage requests.

Verify whether the SQS queue is configured to invoke a Lambda function

When an SQS queue is configured to invoke an AWS Lambda function, the Lambda long polls the queue. This means that even if the SQS queue isn't used, a Lambda function invocation results in empty receives and associated charges.

Best practices to reduce Amazon SQS costs

Follow these best practices to minimize Amazon SQS costs:

Remove queues that aren’t needed

To prevent ReceiveMessage requests made to inactive queues, consider deleting SQS queues when they are no longer needed.

Scale down consumers

Horizontal scaling is used to maximize Amazon SQS queue throughput by increasing the number of both message producers and consumers as your volume requirements increase. Similarly, when the message rate reduces, be sure to scale down the consumers to prevent unnecessary ReceiveMessage requests.

Long polling

Amazon SQS long polling helps reduce both costs and empty receives. You can set the ReceiveMessage wait time to a value of up to 20s to activate long polling. You can specify the wait time using either of the following methods:

  • At the queue level, you can configure the ReceiveMessageWaitTimeSeconds queue attribute.
  • At the message level, you can send the ReceiveMessage API call with the ReceiveMessageWaitTime parameter.
    Note: Setting the ReceiveMessageWaitTime parameter at the message level in the ReceiveMessage API overrides the parameter value configured at the queue level. For a Lambda function invoked using Amazon SQS, Lambda uses long polling to poll a queue.

Batch operations

Amazon SQS pricing is based on the number of requests. You can reduce the number of requests, and in turn reduce costs, by batching the message actions. For example, instead of calling the SendMessage API 10 times, a single SendMessageBatch operation can be configured to send 10 messages. Other available batch operation actions include DeleteMessageBatch and ChangeMessageVisibilityBatch.

Did this article help?

Do you need billing or technical support?