Getting started
This walkthrough takes a few minutes: you create a queue, create an access key and exchange the first message with the AWS CLI. The same path works for the SDKs, shown in SDK examples.
Before you start
You need:
| Item | Why |
|---|---|
| Access to the NNumbers Console in the right organization | Resources belong to the active organization |
| The Editor role in Messaging | To create the queue |
| The Admin role in Messaging | To create the access key (or ask an admin) |
| AWS CLI v2 installed | For the send and receive test |
Open Documentation and examples in the Messaging module and check the Queues address and the region. The addresses https://nqs.msg.nnumbers.com.br (Queues), https://nns.msg.nnumbers.com.br (Notifications) and https://nes.msg.nnumbers.com.br (Email) are the planned ones; the page shows the current configuration and whether they are already published.
1. Create the queue
- In the Console, open Messaging and then Queues.
- Start creating a new queue.
- Choose the Standard type and give it a name, for example
orders. The name accepts letters, digits, hyphens and underscores, up to 80 characters. - Keep the default attributes (30 s visibility timeout, 4-day retention) and confirm.
The queue shows up in the list with its URL and ARN. The URL has the format https://nqs.msg.nnumbers.com.br/<account>/orders, where <account> is the organization's 12-digit virtual account.
Want to check the queue before writing code? Send a test message from the queue page. The approximate message count goes up right after.
2. Create the access key
- Open Access credentials and start creating a new key.
- Give it a description that identifies the application, for example
getting started test. - For this test, you can restrict the key to the
ordersqueue. - Confirm and copy the access key ID and the secret key.
Store the secret key in a secret manager. It is not shown again; if you lose it, revoke the key and create another one.
3. Send and receive
Export the credential in the terminal (the value comes from your secret manager and is never written in a script):
export AWS_ACCESS_KEY_ID="$(cat /protected/path/key-id)"
export AWS_SECRET_ACCESS_KEY="$(cat /protected/path/secret-key)"
export AWS_DEFAULT_REGION=br-se-1
ENDPOINT=https://nqs.msg.nnumbers.com.br
Find the queue URL, then send, receive and delete the message:
QUEUE_URL=$(aws sqs get-queue-url --endpoint-url "$ENDPOINT" \
--queue-name orders --query QueueUrl --output text)
aws sqs send-message --endpoint-url "$ENDPOINT" \
--queue-url "$QUEUE_URL" --message-body "order 42 created"
aws sqs receive-message --endpoint-url "$ENDPOINT" \
--queue-url "$QUEUE_URL" --wait-time-seconds 10
aws sqs delete-message --endpoint-url "$ENDPOINT" \
--queue-url "$QUEUE_URL" --receipt-handle "<ReceiptHandle received>"
If the message is not deleted, it becomes visible again when the visibility timeout ends and is delivered again. That is the expected behavior of a queue: delete only after processing.
If something goes wrong
| Error | Likely cause |
|---|---|
InvalidClientTokenId | Wrong key ID or revoked key |
SignatureDoesNotMatch | Wrong secret key, a region other than br-se-1, or the machine clock more than 5 minutes ahead or behind |
AccessDenied | The key has action or queue restrictions that do not include this operation or this queue |
NonExistentQueue | Wrong queue name, or the queue belongs to another organization |
Next steps
- Queues: types, attributes and dead-letter queues.
- Notifications: fan a message out to several subscribers.
- Email: verify a domain and send the first email.
- SDK examples: Java, Python, Node.js and the AWS CLI.
Was this page helpful?
Report a problem on this pageDo not send passwords, keys, tokens, or customer data.