Menu
Amazon Simple Queue Service
Developer Guide

Tutorial: Deleting an Amazon SQS Queue

If you don't use an Amazon SQS queue (and don't foresee using it in the near future), it is a best practice to delete it from Amazon SQS. In this tutorial you'll learn how to delete a queue.

Note

You can delete a queue even when it isn't empty. If you want to delete the messages in a queue but not the queue itself, you can purge the queue.

By default, a queue retains a message for four days after it is sent. You can configure a queue to retain messages for up to 14 days.

AWS Management Console

  1. Sign in to the Amazon SQS console.

  2. From the queue list, select a queue.

  3. From Queue Actions, select Delete Queue.

    The Delete Queues dialog box is displayed.

  4. Choose Yes, Delete Queue.

    The queue is deleted.

AWS SDK for Java

Before you begin working with the example code, specify your AWS credentials. For more information, see Set up AWS Credentials and Region for Development in the AWS SDK for Java Developer Guide.

Note

This action is identical for standard and FIFO queues.

  1. Copy the standard queue example program or the FIFO queue example program.

    The following section of the code deletes the queue:

    // Delete the queue System.out.println("Deleting the test queue.\n"); sqs.deleteQueue(new DeleteQueueRequest(myQueueUrl));
  2. Compile and run the example.

    The queue is deleted.