Messaging and Queuing SQS API

Introduction

The Simple Queue Service, or SQS, is a managed messaging service developed by AWS and supported by Scaleway Messaging and Queuing. If you're new to SQS, you can learn more about it on our SQS/SNS overview page.

Tip:

If SQS is not the Messaging and Queuing service you're looking for, check out our NATS or SNS services. We strongly recommend you read our dedicated documentation to find out more about the migration from v1alpha1 to v1beta1. SQS users must manually migrate to v1beta1 by recreating their resources. v1alpha1 will soon be deprecated, and all non-migrated resources will be lost. You can also consult the legacy v1alpha1 API.

Concepts

Refer to our dedicated concepts page to find definitions of all terminology related to Messaging and Queuing.

Quickstart

  1. Configure your environment variables

    Note:

    This is an optional step that seeks to simplify your usage of the API.

    export SCW_SECRET_KEY="<API secret key>"
    export SCW_PROJECT_ID="<Scaleway Project ID>"
  2. Activate the SQS protocol on your Scaleway Project:

    curl --silent -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    -H "Content-Type: application/json" \
    "https://api.scaleway.com/mnq/v1beta1/regions/fr-par/activate-sqs" \
    -d '{
    "project_id": "'$SCW_PROJECT_ID'"
    }' | jq
    curl --silent -X GET \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    -H "Content-Type: application/json" \
    "https://api.scaleway.com/mnq/v1beta1/regions/fr-par/sqs-info?project_id=$SCW_PROJECT_ID" \
    | tee my-sqs-account.json | jq
    Tip:
    • | tee my-sqs-account.json saves the JSON object returned by the API to a file (used by next steps)
    • | jq displays the output nicely
  3. Create credentials. Credentials are necessary to authenticate a client to your SQS service. Their permissions should be specified and adapted according to your needs, using true or false for each type of permission.

    curl --silent -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    -H "Content-Type: application/json" \
    "https://api.scaleway.com/mnq/v1beta1/regions/fr-par/sqs-credentials" \
    -d '{
    "name": "my-credentials",
    "permissions": {
    "can_publish": true,
    "can_receive": true,
    "can_manage": true
    },
    "project_id": "'$SCW_PROJECT_ID'"
    }' | tee my-sqs-credentials.json | jq
  4. Export credentials: Export the credentials to your environment:

    export AWS_ENDPOINT_URL=$(jq -r .sqs_endpoint_url my-sqs-account.json)
    export AWS_ACCESS_KEY_ID=$(jq -r .access_key my-sqs-credentials.json)
    export AWS_SECRET_ACCESS_KEY=$(jq -r .secret_key my-sqs-credentials.json)
  5. Start creating queues and messages. The following commands show you how to create a queue, and send, receive and delete a message

    aws sqs create-queue --queue-name my-queue | tee my-queue.json
    aws sqs send-message --queue-url "$(jq -r .QueueUrl my-queue.json)" \
    --message-body 'Hello world!'
    aws sqs receive-message --queue-url "$(jq -r .QueueUrl my-queue.json)" \
    > my-sqs-message.json
    aws sqs delete-message --queue-url "$(jq -r .QueueUrl my-queue.json)" \
    --receipt-handle "$(jq -r '.Messages[0].ReceiptHandle' my-sqs-message.json)"
  6. Disable SQS

    Important:

    Disabling SQS deletes all queues and messages stored in your SQS service.

    curl --silent -X POST \
    -H "X-Auth-Token: $SCW_SECRET_KEY" \
    -H "Content-Type: application/json" \
    "https://api.scaleway.com/mnq/v1beta1/regions/fr-par/deactivate-sqs" \
    -d '{
    "project_id": "'$SCW_PROJECT_ID'"
    }' | jq
Requirements:

Technical limitations

Scaleway Messaging and Queuing does not support the entire set of AWS SQS actions or parameters. See the compatibility matrix for more information.

Also note that:

  • The maximum message size is 256 kB.
  • The maximum storage capacity for all queues of a project is 100 MB.

Technical information

Regional availability

Scaleway Messaging and Queuing is currently only available in the Paris, France region (fr-par).

SQS credentials

Credentials use a simplified permissions system with 3 permissions:

  • can_publish : allows to send messages to a Queue.
  • can_receive : allows to receive and acknowledge (delete) messages.
  • can_manage : allows all other actions (Creating, Listing, Updating, Deleting Queues).

Each set of credentials gives access to all queues. Isolation can be handled by using several Scaleway Projects.

Going further

For more help using Scaleway Messaging and Queuing, check out the following resources:

You can also read the AWS SQS documentation.

SQS

SQS (Simple Queue Service) provides a queuing service. It must be activated per Project before being used

POST
/mnq/v1beta1/regions/{region}/activate-sqs
POST
/mnq/v1beta1/regions/{region}/deactivate-sqs
GET
/mnq/v1beta1/regions/{region}/sqs-info

Sqs Credentials

SQS credentials

GET
/mnq/v1beta1/regions/{region}/sqs-credentials
POST
/mnq/v1beta1/regions/{region}/sqs-credentials
GET
/mnq/v1beta1/regions/{region}/sqs-credentials/{sqs_credentials_id}
PATCH
/mnq/v1beta1/regions/{region}/sqs-credentials/{sqs_credentials_id}
DELETE
/mnq/v1beta1/regions/{region}/sqs-credentials/{sqs_credentials_id}