CreateStreamCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { KinesisVideoClient, CreateStreamCommand } from "@aws-sdk/client-kinesis-video"; // ES Modules import
// const { KinesisVideoClient, CreateStreamCommand } = require("@aws-sdk/client-kinesis-video"); // CommonJS import
const client = new KinesisVideoClient(config);
const input = { // CreateStreamInput
  DeviceName: "STRING_VALUE",
  StreamName: "STRING_VALUE", // required
  MediaType: "STRING_VALUE",
  KmsKeyId: "STRING_VALUE",
  DataRetentionInHours: Number("int"),
  Tags: { // ResourceTags
    "<keys>": "STRING_VALUE",
  },
};
const command = new CreateStreamCommand(input);
const response = await client.send(command);
// { // CreateStreamOutput
//   StreamARN: "STRING_VALUE",
// };

CreateStreamCommand Input

See CreateStreamCommandInput for more details

Parameter
Type
Description
StreamName
Required
string | undefined

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.

DataRetentionInHours
number | undefined

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.

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.

DeviceName
string | undefined

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

In the current implementation, Kinesis Video Streams does not use this name.

KmsKeyId
string | undefined

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 (Amazon Web Services/kinesisvideo) is used.

For more information, see DescribeKey .

MediaType
string | undefined

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).

Tags
Record<string, string> | undefined

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

CreateStreamCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
StreamARN
string | undefined

The Amazon Resource Name (ARN) of the stream.

Throws

Name
Fault
Details
AccountStreamLimitExceededException
client

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

ClientLimitExceededException
client

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

DeviceStreamLimitExceededException
client

Not implemented.

InvalidArgumentException
client

The value for this input parameter is invalid.

InvalidDeviceException
client

Not implemented.

ResourceInUseException
client

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
client

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

KinesisVideoServiceException
Base exception class for all service exceptions from KinesisVideo service.