Using Scaleway Queues with the AWS-CLI
The AWS-CLI is an open-source tool built on top of the AWS SDK for Python (Boto) that provides commands for interacting with AWS services. Once you have connected Scaleway Queues to the AWS-CLI, you can start creating, listing and managing your queues, sending messages and much more, all from your command line.
Before you startLink to this anchor
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions allowing you to perform actions in the intended Organization
- Valid credentials for Queues
- Connected Queues to the AWS-CLI
- jq installed on your machine
Getting started with Scaleway QueuesLink to this anchor
-
Use the following command to create a queue:
aws sqs create-queue --queue-name MyQueue | tee my-queue.json -
Use the following command to list existing queues:
aws sqs list-queues -
Use the following command to send messages to a queue:
aws sqs send-message --queue-url $(jq -r .QueueUrl my-queue.json) --message-body "Hello world!"aws sqs send-message --queue-url $(jq -r .QueueUrl my-queue.json) --message-body "Second Message." -
Use the following command to receive messages:
aws sqs receive-message --queue-url $(jq -r .QueueUrl my-queue.json) | tee message1.jsonaws sqs receive-message --queue-url $(jq -r .QueueUrl my-queue.json) | tee message2.json -
Use the following command to delete messages. This is necessary as once a message has been processed on your consumer side (typically by a worker), it will be re-queued unless it is explicitly deleted.
aws sqs delete-message --queue-url $(jq -r .QueueUrl my-queue.json) --receipt-handle $(jq -r .Messages[0].ReceiptHandle message1.json)aws sqs delete-message --queue-url $(jq -r .QueueUrl my-queue.json) --receipt-handle $(jq -r .Messages[0].ReceiptHandle message2.json) -
Use the following command to delete the queue itself:
aws sqs delete-queue --queue-url $(jq -r .QueueUrl my-queue.json)