View a markdown version of this page

Use PurgeQueue with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use PurgeQueue with a CLI

The following code examples show how to use PurgeQueue.

CLI
AWS CLI

To purge a queue

The following purge-queue example deletes all messages in the specified queue.

aws sqs purge-queue \ --queue-url https://sqs.us-west-2.amazonaws.com/80398EXAMPLE/MyNewQueue

This command produces no output.

For more information, see Purging messages from an queue using the Amazon SQS console in the Amazon Simple Queue Service Developer Guide.

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

PowerShell
Tools for PowerShell V4

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 AWS Tools for PowerShell Cmdlet Reference (V4).

Tools for PowerShell V5

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 AWS Tools for PowerShell Cmdlet Reference (V5).