DeleteStreamCommand

Deletes a Kinesis data stream and all its shards and data. You must shut down any applications that are operating on the stream before you delete the stream. If an application attempts to operate on a deleted stream, it receives the exception ResourceNotFoundException.

When invoking this API, you must use either the StreamARN or the StreamName parameter, or both. It is recommended that you use the StreamARN input parameter when you invoke this API.

If the stream is in the ACTIVE state, you can delete it. After a DeleteStream request, the specified stream is in the DELETING state until Kinesis Data Streams completes the deletion.

Note: Kinesis Data Streams might continue to accept data read and write operations, such as PutRecord, PutRecords, and GetRecords, on a stream in the DELETING state until the stream deletion is complete.

When you delete a stream, any shards in that stream are also deleted, and any tags are dissociated from the stream.

You can use the DescribeStreamSummary operation to check the state of the stream, which is returned in StreamStatus.

DeleteStream has a limit of five transactions per second per account.

Example Syntax

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

import { KinesisClient, DeleteStreamCommand } from "@aws-sdk/client-kinesis"; // ES Modules import
// const { KinesisClient, DeleteStreamCommand } = require("@aws-sdk/client-kinesis"); // CommonJS import
const client = new KinesisClient(config);
const input = { // DeleteStreamInput
  StreamName: "STRING_VALUE",
  EnforceConsumerDeletion: true || false,
  StreamARN: "STRING_VALUE",
};
const command = new DeleteStreamCommand(input);
const response = await client.send(command);
// {};

DeleteStreamCommand Input

See DeleteStreamCommandInput for more details

Parameter
Type
Description
EnforceConsumerDeletion
boolean | undefined

If this parameter is unset (null) or if you set it to false, and the stream has registered consumers, the call to DeleteStream fails with a ResourceInUseException.

StreamARN
string | undefined

The ARN of the stream.

StreamName
string | undefined

The name of the stream to delete.

DeleteStreamCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
AccessDeniedException
client

Specifies that you do not have the permissions required to perform this operation.

InvalidArgumentException
client

A specified parameter exceeds its restrictions, is not supported, or can't be used. For more information, see the returned message.

LimitExceededException
client

The requested resource exceeds the maximum number allowed, or the number of concurrent stream requests exceeds the maximum number allowed.

ResourceInUseException
client

The resource is not available for this operation. For successful operation, the resource must be in the ACTIVE state.

ResourceNotFoundException
client

The requested resource could not be found. The stream might not be specified correctly.

KinesisServiceException
Base exception class for all service exceptions from Kinesis service.