How to purge an SQS queue from AWS CLI

To delete all the messages in an SQS queue without deleting the queue itself, use the purge option as below: First obtain the url of the queue using get-queue-url command

aws sqs get-queue-url --queue-name queuename

Substitute the above obtained url in the below command to purge the queue.

aws sqs purge-queue --queue-url <url-of-the-queue>

See also  How to vacuum a table in Redshift database