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
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Data Streams
    • All guides
    • Managing data streams
      • Preparing the environment
      • Creating a 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. Creating a stream

Creating a stream in the AWS SDK

Written by
Yandex Cloud
Updated at April 27, 2024
Python

Use the create_stream method to create a stream. When you invoke this method, you should specify the following parameters:

  • Name of a stream being created, e.g., example-stream.
  • ID of a cloud to host the stream, e.g., b1gi1kuj2dht********.
  • ID of an existing serverless YDB database, e.g., cc8028jgtuab********. For information about how to create a database, see the YDB documentation.
  • Number of shards, e.g., 1.

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

To create a stream with the parameters specified above:

  1. Create a file named stream_create.py and copy the following code into it:

    import boto3
    from pprint import pprint
    
    def create_stream(cloud, database, stream_name, shard_count):
        client = boto3.client('kinesis', endpoint_url="https://yds.serverless.yandexcloud.net")
        response = client.create_stream(
          StreamName="/ru-central1/{cloud}/{database}/{stream}".format(cloud=cloud,
                                                                        database=database,
                                                                        stream=stream_name),
          ShardCount=shard_count
        )
        return response
    
    if __name__ == '__main__':
      create_stream_response = create_stream(
        cloud="b1gi1kuj2dht********",
        database="cc8028jgtuab********",
        stream_name="example-stream",
        shard_count=1)
      print("The stream has been created successfully")
      pprint(create_stream_response)
    
  2. Run the program:

    python3 stream_create.py
    

    Result:

    The stream has been created successfully
    {
      'ResponseMetadata': {
        'HTTPHeaders': {
          'connection': 'keep-alive',
          'content-length': '3',
          'content-type': 'application/json',
          'date': ''
          'GMT',
          'server': 'nginx/1.19.5',
          'HTTPStatusCode': 200,
          'RetryAttempts': 0
        }
      }
    }
    

Was the article helpful?

Previous
Preparing the environment
Next
Sending data to a stream
© 2025 Direct Cursus Technology L.L.C.