Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Yandex Data Streams
  • Access management
  • Pricing policy
    • Overview
    • Authenticating and connecting to а database
  • FAQ

In this article:

  • Endpoint
  • Prerequisites
  • Authentication
  • Queue creation example
  • Example of writing and reading a message
  1. Amazon SQS-compatible HTTP API
  2. Authenticating and connecting to а database

Authenticating and connecting to a database via the Amazon SQS-compatible HTTP API

Written by
Yandex Cloud
Updated at October 2, 2026
View in Markdown
  • Endpoint
  • Prerequisites
  • Authentication
  • Queue creation example
  • Example of writing and reading a message

EndpointEndpoint

The connection endpoint is displayed in the management console on your database page. This endpoint is identical for both Amazon Kinesis Data Streams and Amazon Simple Queue Service (SQS) protocols.

PrerequisitesPrerequisites

To authenticate, take these steps:

  1. Create a service account.
  2. Assign the following roles to the service account:
    • To read from a data stream: ydb.viewer.
    • To write to a data stream: ydb.editor.
    • To create or delete a queue: ydb.editor.
  3. Create a static access key for the service account. Save the ID and secret key to a secure location.

AuthenticationAuthentication

Just like Amazon SQS, the Amazon SQS-compatible HTTP API uses Signature Version 4 to authenticate requests.

The following parameters are required:

  • <access_key_id>: Static access key ID.
  • <secret_access_key>: Secret part of the static access key.

Configure the AWS CLI:

  1. Launch the interactive profile setup:

    aws configure
    
  2. Specify the service account key ID you obtained earlier:

    AWS Access Key ID [****************ver_]: <service_account_key_ID>
    
  3. Specify the service account secret key you obtained earlier:

    AWS Secret Access Key [****************w5lb]: <service_account_secret_key>
    
  4. Specify the ru-central1 default region name:

    Default region name [ru-central1]: ru-central1
    
  5. Specify json as the default format for output data:

    Default output format [None]: json
    
  6. To view the current profile settings, run this command:

    aws configure list
    

    Result:

          Name                    Value             Type    Location
          ----                    -----             ----    --------
       profile                <not set>             None    None
    access_key     ****************aBc1 shared-credentials-file
    secret_key     ****************DeF2 shared-credentials-file
        region              ru-central1      config-file    ~/.aws/config
    

Queue creation exampleQueue creation example

This example uses the following parameters:

  • <sqs_api_endpoint>: Endpoint.
  • <stream_name>: Data stream name.
  1. Install the AWS CLI if you have not done that already.

  2. Create a queue:

    aws --endpoint "<sqs_api_endpoint>" sqs create-queue \
      --queue-name "<stream_name>"
    

    This command creates a data stream with the specified name and a shared consumer named ydb-sqs-consumer.

    To create a FIFO queue, specify FifoQueue=true. We recommend appending .fifo to the queue name:

    aws --endpoint "<sqs_api_endpoint>" sqs create-queue \
      --queue-name "<stream_name>.fifo" \
      --attributes FifoQueue=true
    

Example of writing and reading a messageExample of writing and reading a message

This example uses the following parameters:

  • <sqs_api_endpoint>: Endpoint.
  • <stream_name>: Data stream name.
  1. Install the AWS CLI if you have not done that already.

  2. Get the stream QueueUrl:

    QUEUE_URL="$(aws --endpoint "<sqs_api_endpoint>" sqs get-queue-url \
      --queue-name "<stream_name>" \
      --query 'QueueUrl' --output text)"
    
  3. Send a message to the stream:

    aws --endpoint "<sqs_api_endpoint>" sqs send-message \
      --queue-url "$QUEUE_URL" \
      --message-body "test message"
    
  4. Read a message from the stream:

    aws --endpoint "<sqs_api_endpoint>" sqs receive-message \
      --queue-url "$QUEUE_URL" \
      --wait-time-seconds 20 \
      --max-number-of-messages 1
    

For details on working with Data Streams via an Amazon SQS-compatible HTTP API and more examples, refer to the YDB guides.

Was the article helpful?

Previous
Overview
Next
FAQ
© 2026 Direct Cursus Technology L.L.C.