:doc:`IoT <../../iot>` / Client / create_stream

*************
create_stream
*************



.. py:method:: IoT.Client.create_stream(**kwargs)

  

  Creates a stream for delivering one or more large files in chunks over MQTT. A stream transports data bytes in chunks or blocks packaged as MQTT messages from a source like S3. You can have one or more files associated with a stream.

   

  Requires permission to access the `CreateStream <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/CreateStream>`_  


  **Request Syntax**
  ::

    response = client.create_stream(
        streamId='string',
        description='string',
        files=[
            {
                'fileId': 123,
                's3Location': {
                    'bucket': 'string',
                    'key': 'string',
                    'version': 'string'
                }
            },
        ],
        roleArn='string',
        tags=[
            {
                'Key': 'string',
                'Value': 'string'
            },
        ]
    )
    
  :type streamId: string
  :param streamId: **[REQUIRED]** 

    The stream ID.

    

  
  :type description: string
  :param description: 

    A description of the stream.

    

  
  :type files: list
  :param files: **[REQUIRED]** 

    The files to stream.

    

  
    - *(dict) --* 

      Represents a file to stream.

      

    
      - **fileId** *(integer) --* 

        The file ID.

        

      
      - **s3Location** *(dict) --* 

        The location of the file in S3.

        

      
        - **bucket** *(string) --* 

          The S3 bucket.

          

        
        - **key** *(string) --* 

          The S3 key.

          

        
        - **version** *(string) --* 

          The S3 bucket version.

          

        
      
    

  :type roleArn: string
  :param roleArn: **[REQUIRED]** 

    An IAM role that allows the IoT service principal to access your S3 files.

    

  
  :type tags: list
  :param tags: 

    Metadata which can be used to manage streams.

    

  
    - *(dict) --* 

      A set of key/value pairs that are used to manage the resource.

      

    
      - **Key** *(string) --* **[REQUIRED]** 

        The tag's key.

        

      
      - **Value** *(string) --* 

        The tag's value.

        

      
    

  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'streamId': 'string',
          'streamArn': 'string',
          'description': 'string',
          'streamVersion': 123
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **streamId** *(string) --* 

        The stream ID.

        
      

      - **streamArn** *(string) --* 

        The stream ARN.

        
      

      - **description** *(string) --* 

        A description of the stream.

        
      

      - **streamVersion** *(integer) --* 

        The version of the stream.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

  
  *   :py:class:`IoT.Client.exceptions.LimitExceededException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceAlreadyExistsException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`IoT.Client.exceptions.ServiceUnavailableException`

  
  *   :py:class:`IoT.Client.exceptions.InternalFailureException`

  