Skip to content

create_stream async

create_stream(
    stream_name: StreamName,
    *,
    config_overrides: Optional[AsyncKinesisVideoClientConfig] = None,
    device_name: Optional[DeviceName] = None,
    media_type: Optional[MediaType] = None,
    kms_key_id: Optional[KmsKeyId] = None,
    data_retention_in_hours: Optional[DataRetentionInHours] = None,
    tags: Optional[ResourceTags] = None,
    stream_storage_configuration: Optional[StreamStorageConfiguration] = None,
) -> CreateStreamOutput

Creates a new Kinesis video stream.

When you create a new stream, Kinesis Video Streams assigns it a version number. When you change the stream's metadata, Kinesis Video Streams updates the version.

CreateStream is an asynchronous operation.

For information about how the service works, see How it Works.

You must have permissions for the KinesisVideo:CreateStream action.

Parameters:

  • device_name (Optional[DeviceName], default: None ) –

    The name of the device that is writing to the stream.

    In the current implementation, Kinesis Video Streams doesn't use this name.

  • stream_name (StreamName) –

    A name for the stream that you are creating.

    The stream name is an identifier for the stream, and must be unique for each account and region.

  • media_type (Optional[MediaType], default: None ) –

    The media type of the stream. Consumers of the stream can use this information when processing the stream. For more information about media types, see Media Types. If you choose to specify the MediaType, see Naming Requirements for guidelines.

    Example valid values include "video/h264" and "video/h264,audio/aac".

    This parameter is optional; the default value is null (or empty in JSON).

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The ID of the Key Management Service (KMS) key that you want Kinesis Video Streams to use to encrypt stream data.

    If no key ID is specified, the default, Kinesis Video-managed key (aws/kinesisvideo) is used.

    For more information, see DescribeKey.

  • data_retention_in_hours (Optional[DataRetentionInHours], default: None ) –

    The number of hours that you want to retain the data in the stream. Kinesis Video Streams retains the data in a data store that is associated with the stream.

    The default value is 0, indicating that the stream does not persist data. The minimum is 1 hour.

    When the DataRetentionInHours value is 0, consumers can still consume the fragments that remain in the service host buffer, which has a retention time limit of 5 minutes and a retention memory limit of 200 MB. Fragments are removed from the buffer when either limit is reached.

  • tags (Optional[ResourceTags], default: None ) –

    A list of tags to associate with the specified stream. Each tag is a key-value pair (the value is optional).

  • stream_storage_configuration (Optional[StreamStorageConfiguration], default: None ) –

    The configuration for the stream's storage, including the default storage tier for stream data. This configuration determines how stream data is stored and accessed, with different tiers offering varying levels of performance and cost optimization.

    If not specified, the stream will use the default storage configuration with HOT tier for optimal performance.

Raises:

  • AccountStreamLimitExceededException –

    The number of streams created for the account is too high.

  • ClientLimitExceededException –

    Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client calls. Try making the call later.

  • DeviceStreamLimitExceededException –

    Not implemented.

  • InvalidArgumentException –

    The value for this input parameter is invalid.

  • InvalidDeviceException –

    Not implemented.

  • ResourceInUseException –

    When the input StreamARN or ChannelARN in CLOUD_STORAGE_MODE is already mapped to a different Kinesis Video Stream resource, or if the provided input StreamARN or ChannelARN is not in Active status, try one of the following :

    1. The DescribeMediaStorageConfiguration API to determine what the stream given channel is mapped to.

    2. The DescribeMappedResourceConfiguration API to determine the channel that the given stream is mapped to.

    3. The DescribeStream or DescribeSignalingChannel API to determine the status of the resource.

  • TagsPerResourceExceededLimitException –

    You have exceeded the limit of tags that you can associate with the resource. A Kinesis video stream can support up to 50 tags.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_kinesis_video/_services/async_kinesis_video.py
async def create_stream(
    self,
    stream_name: "capo_kinesis_video.types.stream_name.StreamName",
    *,
    config_overrides: Optional[AsyncKinesisVideoClientConfig] = None,
    device_name: Optional["capo_kinesis_video.types.device_name.DeviceName"] = None,
    media_type: Optional["capo_kinesis_video.types.media_type.MediaType"] = None,
    kms_key_id: Optional["capo_kinesis_video.types.kms_key_id.KmsKeyId"] = None,
    data_retention_in_hours: Optional[
        "capo_kinesis_video.types.data_retention_in_hours.DataRetentionInHours"
    ] = None,
    tags: Optional["capo_kinesis_video.types.resource_tags.ResourceTags"] = None,
    stream_storage_configuration: Optional[
        "capo_kinesis_video.types.stream_storage_configuration.StreamStorageConfiguration"
    ] = None,
) -> "capo_kinesis_video.types.create_stream_output.CreateStreamOutput":
    """<p>Creates a new Kinesis video stream. </p> <p>When you create a new stream, Kinesis Video Streams assigns it a version number. When you change the stream's metadata, Kinesis Video Streams updates the version. </p> <p> <code>CreateStream</code> is an asynchronous operation.</p> <p>For information about how the service works, see <a href="https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/how-it-works.html">How it Works</a>. </p> <p>You must have permissions for the <code>KinesisVideo:CreateStream</code> action.</p>

    Args:
        device_name: <p>The name of the device that is writing to the stream. </p> <note> <p>In the current implementation, Kinesis Video Streams doesn't use this name.</p> </note>
        stream_name: <p>A name for the stream that you are creating.</p> <p>The stream name is an identifier for the stream, and must be unique for each account and region.</p>
        media_type: <p>The media type of the stream. Consumers of the stream can use this information when processing the stream. For more information about media types, see <a href="http://www.iana.org/assignments/media-types/media-types.xhtml">Media Types</a>. If you choose to specify the <code>MediaType</code>, see <a href="https://tools.ietf.org/html/rfc6838#section-4.2">Naming Requirements</a> for guidelines.</p> <p>Example valid values include "video/h264" and "video/h264,audio/aac".</p> <p>This parameter is optional; the default value is <code>null</code> (or empty in JSON).</p>
        kms_key_id: <p>The ID of the Key Management Service (KMS) key that you want Kinesis Video Streams to use to encrypt stream data.</p> <p>If no key ID is specified, the default, Kinesis Video-managed key (<code>aws/kinesisvideo</code>) is used.</p> <p> For more information, see <a href="https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html#API_DescribeKey_RequestParameters">DescribeKey</a>. </p>
        data_retention_in_hours: <p>The number of hours that you want to retain the data in the stream. Kinesis Video Streams retains the data in a data store that is associated with the stream.</p> <p>The default value is 0, indicating that the stream does not persist data. The minimum is 1 hour.</p> <p>When the <code>DataRetentionInHours</code> value is 0, consumers can still consume the fragments that remain in the service host buffer, which has a retention time limit of 5 minutes and a retention memory limit of 200 MB. Fragments are removed from the buffer when either limit is reached.</p>
        tags: <p>A list of tags to associate with the specified stream. Each tag is a key-value pair (the value is optional).</p>
        stream_storage_configuration: <p>The configuration for the stream's storage, including the default storage tier for stream data. This configuration determines how stream data is stored and accessed, with different tiers offering varying levels of performance and cost optimization.</p> <p>If not specified, the stream will use the default storage configuration with HOT tier for optimal performance.</p>

    Raises:
        capo_kinesis_video.errors.account_stream_limit_exceeded_exception.AccountStreamLimitExceededException: <p>The number of streams created for the account is too high.</p>
        capo_kinesis_video.errors.client_limit_exceeded_exception.ClientLimitExceededException: <p>Kinesis Video Streams has throttled the request because you have exceeded the limit of allowed client calls. Try making the call later.</p>
        capo_kinesis_video.errors.device_stream_limit_exceeded_exception.DeviceStreamLimitExceededException: <p>Not implemented. </p>
        capo_kinesis_video.errors.invalid_argument_exception.InvalidArgumentException: <p>The value for this input parameter is invalid.</p>
        capo_kinesis_video.errors.invalid_device_exception.InvalidDeviceException: <p>Not implemented.</p>
        capo_kinesis_video.errors.resource_in_use_exception.ResourceInUseException: <p>When the input <code>StreamARN</code> or <code>ChannelARN</code> in <code>CLOUD_STORAGE_MODE</code> is already mapped to a different Kinesis Video Stream resource, or if the provided input <code>StreamARN</code> or <code>ChannelARN</code> is not in Active status, try one of the following : </p> <ol> <li> <p>The <code>DescribeMediaStorageConfiguration</code> API to determine what the stream given channel is mapped to. </p> </li> <li> <p>The <code>DescribeMappedResourceConfiguration</code> API to determine the channel that the given stream is mapped to. </p> </li> <li> <p>The <code>DescribeStream</code> or <code>DescribeSignalingChannel</code> API to determine the status of the resource. </p> </li> </ol>
        capo_kinesis_video.errors.tags_per_resource_exceeded_limit_exception.TagsPerResourceExceededLimitException: <p>You have exceeded the limit of tags that you can associate with the resource. A Kinesis video stream can support up to 50 tags. </p>
        capo_kinesis_video.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_kinesis_video.types.create_stream_input.CreateStreamInput]",
    ) -> AsyncOperationResponse[
        "capo_kinesis_video.types.create_stream_output.CreateStreamOutput"
    ]:
        import capo_kinesis_video._operations.kinesis_video_20170930.create_stream

        (
            output,
            http_response,
        ) = await capo_kinesis_video._operations.kinesis_video_20170930.create_stream.async_create_stream(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateStream")
    )
    input_: capo_kinesis_video.types.create_stream_input.CreateStreamInput = {
        "stream_name": stream_name
    }
    if device_name is not None:
        input_["device_name"] = device_name
    if media_type is not None:
        input_["media_type"] = media_type
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if data_retention_in_hours is not None:
        input_["data_retention_in_hours"] = data_retention_in_hours
    if tags is not None:
        input_["tags"] = tags
    if stream_storage_configuration is not None:
        input_["stream_storage_configuration"] = stream_storage_configuration

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output