Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • Yandex SIEM
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Data Streams
    • All guides
    • Managing data streams
      • Preparing the environment
      • Creating a data stream
      • Sending data to a stream
      • Reading data from a stream
      • Deleting a stream
  • Access management
  • Pricing policy
  • FAQ
  1. Step-by-step guides
  2. Working with the AWS SDK
  3. Sending data to a stream

Sending data to a stream in the AWS SDK

Written by
Yandex Cloud
Updated at July 15, 2025
View in Markdown

Note

You can create a trigger that will invoke a function in Cloud Functions or run a container in Serverless Containers when data is sent to a stream. Read more about triggers for Data Streams.

Python

To send data to a stream, use the put_record/put_records method. When you invoke this method, specify the following parameters:

  • Stream name., e.g., example-stream.
  • ID of the cloud the stream is located in, e.g., b1gi1kuj2dht********.
  • ID of the YDB database containing the stream, e.g., cc8028jgtuab********.
  • Data being sent, e.g., message.

You also need to configure the AWS SDK and assign the service account the yds.writer role.

To send data to the stream with the above parameters:

  1. Create the stream_put_record.py file and paste the following code to it:

    import boto3
    from pprint import pprint
    
    def put_record(cloud, database, stream_name, message):
       client = boto3.client('kinesis', endpoint_url="https://yds.serverless.yandexcloud.net")
       response = client.put_record(
         StreamName="/ru-central1/{cloud}/{database}/{stream}".format(cloud=cloud,
                                                                      database=database,
                                                                      stream=stream_name),
        Data=message,
        PartitionKey=message
      )
      return response
    
    if __name__ == '__main__':
      put_record_response = put_record(
        cloud="b1gi1kuj2dht********",
        database="cc8028jgtuab********",
        stream_name="example-stream",
        message="message")
    
      print("The record has been sent successfully")
      pprint(put_record_response)
    
  2. Run the program:

    python3 stream_put_record.py
    

    Result:

    The record has been sent successfully
    {
      'EncryptionType': 'NONE',
      'ResponseMetadata': {
        'HTTPHeaders': {
          'connection': 'keep-alive',
          'content-length': '81',
          'content-type': 'application/json',
          'date': ''
          'GMT',
          'server': 'nginx/1.19.5'
        },
        'HTTPStatusCode': 200,
        'RetryAttempts': 0
      },
      'SequenceNumber': '0',
      'ShardId': 'shard-000000'
    }
    

Was the article helpful?

Previous
Creating a data stream
Next
Reading data from a stream
© 2026 Direct Cursus Technology L.L.C.