Forrest logo
back to the aws tool

aws-sqs:tldr:a65aa

aws-sqs: Delete all messages from the specified queue.
$ aws sqs purge-queue --queue-url https://sqs.${region}.amazonaws.com/${queue_name}
try on your machine

This command is using the AWS Command Line Interface (CLI) to purge messages from an Amazon Simple Queue Service (SQS) queue.

Here's a breakdown of the command:

  • aws: This is the command to start interacting with the AWS CLI.
  • sqs: This specifies the AWS service we want to interact with, in this case, Amazon SQS.
  • purge-queue: This is the specific action we want to perform, which is to purge all messages in a queue.
  • --queue-url: This flag is used to specify the URL of the queue we want to purge.
    • https://sqs.${region}.amazonaws.com/${queue_name} is the URL of the queue. ${region} and ${queue_name} are placeholders that should be replaced with the corresponding values for your specific queue.
    • ${region} represents the AWS region where the queue is located.
    • ${queue_name} represents the name or identifier of the queue.

By executing this command, all the messages in the specified SQS queue will be removed. It's important to note that the operation is irreversible and the purged messages cannot be recovered. Therefore, exercise caution before using this command.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the aws tool