Use PurgeQueue with a CLI - Amazon Simple Queue Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use PurgeQueue with a CLI

The following code examples show how to use PurgeQueue.

CLI
Amazon CLI

To purge a queue

This example deletes all messages in the specified queue.

Command:

aws sqs purge-queue --queue-url https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyNewQueue

Output:

None.
  • For API details, see PurgeQueue in Amazon CLI Command Reference.

PowerShell
Tools for PowerShell

Example 1: This example deletes all messages from the specified queue.

Clear-SQSQueue -QueueUrl https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyQueue
  • For API details, see PurgeQueue in Amazon Tools for PowerShell Cmdlet Reference.

For a complete list of Amazon SDK developer guides and code examples, see Using Amazon SQS with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.