Skip to main content

Access credentials

Applications authenticate to NNumbers Messaging with access keys, signing every request with AWS Signature Version 4 (SigV4), exactly as they would on AWS. The SDKs and the AWS CLI sign on their own: you only provide the key ID, the secret key and the br-se-1 region.

Sending over SMTP uses a different credential, the SMTP credential, described in Email.

Access keys​

The Access credentials area of the Console lists the organization's keys (without the secret key) with description, status, creation date and restrictions. Creating and revoking keys requires the Admin role.

When you create a key, the Console shows:

FieldWhat it is
Access key IDThe public identifier of the key; goes in AWS_ACCESS_KEY_ID
Secret keyThe secret used in the signature; goes in AWS_SECRET_ACCESS_KEY. Shown only once
AccountThe organization's 12-digit virtual account, used in queue URLs and ARNs
Regionbr-se-1
The secret key is shown only once

Copy the secret key straight into a secret manager. It cannot be retrieved again; if you lose it, revoke the key and create another one.

Each organization can have up to 100 access keys. The same key signs requests to Queues, Notifications and the Email API, subject to the restrictions below.

Restrictions​

Without restrictions, the key is valid for every action and every queue of the organization. Restrict it whenever you can:

RestrictionFormatExamples
ActionsAction name with the service prefix, a per-service wildcard or the full wildcardsqs:SendMessage, sqs:ReceiveMessage, sns:Publish, ses:SendEmail, sqs:*, ses:*, *
QueuesExact name or a prefix ending in *orders, orders-*
  • A key with only sqs:SendMessage and the orders queue can only send to that queue: ideal for a producer.
  • The queue restriction also applies when the key creates a Notifications subscription to a queue or points to a dead-letter queue.
  • A request outside the restrictions gets AccessDenied. A valid signature does not mean permission.

Revocation​

Revoking a key is immediate and final:

  • revocation takes effect at once on the service node that received it and within 60 seconds everywhere else;
  • a revoked key stays in the list with the revoked status, for reference;
  • requests with a revoked key get InvalidClientTokenId.

To replace a key without interrupting the application, create the new one, publish it in your secret manager, restart or reload the application and only then revoke the old one.

Key creation and revocation are recorded in the organization's audit trail, with who did it and when. The secret key never appears in the audit trail.

Good practices​

  • One key per application (or per environment), with a description that identifies the owner. That makes it easy to revoke only what leaked.
  • Least privilege: restrict actions and queues to what the application really uses.
  • Never in code: read the key from environment variables or from the secret manager, never from a versioned file. The examples in SDK examples follow this rule.
  • Periodic rotation: replace keys from time to time, following the steps in the previous section.
  • Synchronized clock: the SigV4 signature includes the time. A difference of more than 5 minutes makes the request fail with SignatureDoesNotMatch.
  • Leaked? Revoke the key immediately and create another one. Revocation is the only way to invalidate the secret key.
ErrorWhat it means
MissingAuthenticationTokenUnsigned request
InvalidClientTokenIdUnknown or revoked key
SignatureDoesNotMatchWrong secret key, region or service, body changed in transit, or clock out of sync
AccessDeniedThe key does not allow this action or this queue