Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Message Queue
    • Overview
    • Configuring the AWS CLI
    • Creating a new message queue
    • Sending messages
    • Receiving and deleting messages
    • Deleting a message queue
    • Managing queue labels
    • Monitoring processes in queues
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Public materials
  • FAQ
  1. Step-by-step guides
  2. Sending messages

Sending messages

Written by
Yandex Cloud
Updated at October 28, 2024

Messages are sent through message queues in Message Queue and may contain plain text in the message body. Consumers get messages and delete them from the queue after receiving and processing them.

To send a message to a queue:

  1. If you do not have a message queue in Message Queue, create one.

  2. Run the following command in the terminal:

    AWS CLI
    cURL
    aws sqs send-message \
      --message-body "<message_text>" \
      --endpoint <endpoint> \
      --queue-url <queue_URL>
    

    Where:

    • --message-body: Text of the message you want to send to the queue, e.g., Hello World.
    • --endpoint: Endpoint in the https://message-queue.api.cloud.yandex.net/ value.
    • --queue-url: URL of the queue the message will be sent to.

    Result:

    {
        "MD5OfMessageBody": "67e63db14341b5a696596634********",
        "MessageId": "765ff4d2-fa4bc83-6cfcc***-*****"
    }
    
    curl \
      --request POST \
      --header 'Content-Type: application/x-www-form-urlencoded' \
      --data-urlencode 'Action=SendMessage' \
      --data-urlencode 'MessageBody=<message_text>' \
      --data-urlencode 'QueueUrl=<message_queue_URL>' \
      --user '<access_key_ID>:<secret_key>' \
      --aws-sigv4 'aws:amz:ru-central1:sqs' \
      https://message-queue.api.cloud.yandex.net/
    

    Where:

    • --header: HTTP request headers.
    • --data-urlencode: Parameters for generating an API request.
      • MessageBody: Text of the message you want to send to the queue.
      • QueueURL: URL of the queue the message will be sent to.
    • --user: Static key components (ID and secret key).
    • --aws-sigv4: Parameter for generating AWS-compatible authorization headers.

    Result:

    <?xml version="1.0" encoding="UTF-8"?>
    <SendMessageResponse><SendMessageResult><MD5OfMessageBody>fa46dfdbe2396ac930bfa896********</MD5OfMessageBody><MessageId>31bebd6e-5b61e482-7aaaa45a***-*****</MessageId></SendMessageResult><ResponseMetadata><RequestId>7c65c427-be26a31a-cf93dee9-dd4989d8-ab97b54614e49d7fe560b779********</RequestId></ResponseMetadata></SendMessageResponse>
    

Was the article helpful?

Previous
Creating a new message queue
Next
Receiving and deleting messages
Yandex project
© 2025 Yandex.Cloud LLC