Skip to main content

streams

Creates, updates, deletes, gets or lists a streams resource.

Overview

Namestreams
TypeResource
Idaws.dsql.streams

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe ARN of the retrieved stream. (pattern: <code>arn:aws(-[^:]+)?:dsql:[a-z0-9-]{1,20}:[0-9]{12}:cluster/[a-z0-9]{26}/stream/[a-z0-9]{26}</code>)
cluster_identifierstringThe ID of the cluster. (pattern: <code>[a-z0-9]{26}</code>)
creation_timestring (date-time)The time when the stream was created.
format_stringStream record format. JSON Stream records are formatted as JSON. (JSON)
orderingstringStream ordering mode. UNORDERED Changes are streamed without ordering guarantees. (UNORDERED)
statusstringThe current status of the retrieved stream. (CREATING, ACTIVE, DELETING, DELETED, FAILED, IMPAIRED)
status_reasonobjectStream status reason with error code and timestamp (if applicable).
stream_identifierstringThe ID of the stream. (pattern: <code>[a-z0-9]{26}</code>)
tagsobjectA map of tags associated with the stream.
target_definitionobjectTarget definition for stream destination.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_streamselectcluster_identifier, stream_identifier, regionRetrieves information about a stream.
list_streamsselectcluster_identifier, regionmax-results, next-tokenRetrieves information about a list of streams for a cluster.
create_streaminsertcluster_identifier, region, targetDefinition, ordering, formatCreates a new change data capture (CDC) stream for a cluster. The stream captures database changes and delivers them to the specified target destination. Required permissions dsql:CreateStream Permission to create a new stream. Resources: arn:aws:dsql:region:account-id:cluster/cluster-id iam:PassRole Permission to pass the IAM role specified in the target definition to the service. Resources: ARN of the IAM role specified in targetDefinition.kinesis.roleArn kms:Decrypt Required when the cluster uses a customer managed KMS key (CMK). Permission to decrypt data using the cluster's CMK. Resources: ARN of the KMS key used by the cluster
delete_streamdeletecluster_identifier, stream_identifier, regionclient-tokenDeletes a stream from a cluster.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
cluster_identifierstringThe ID of the cluster containing the stream to delete.
regionstringAWS region (default: us-east-1)
stream_identifierstringThe ID of the stream to delete.
client-tokenstringA unique, case-sensitive identifier that you provide to ensure the idempotency of the request. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries with the same client token return the result from the original successful request and they have no additional effect. If you don't specify a client token, the Amazon Web Services SDK automatically generates one.
max-resultsintegerAn optional parameter that specifies the maximum number of results to return. You can use nextToken to display the next page of results. Default: 10.
next-tokenstringIf your initial ListStreams operation returns a nextToken, you can include the returned nextToken in following ListStreams operations, which returns results in the next page.

SELECT examples

Retrieves information about a stream.

SELECT
arn,
cluster_identifier,
creation_time,
format_,
ordering,
status,
status_reason,
stream_identifier,
tags,
target_definition
FROM aws.dsql.streams
WHERE cluster_identifier = '{{ cluster_identifier }}' -- required
AND stream_identifier = '{{ stream_identifier }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a new change data capture (CDC) stream for a cluster. The stream captures database changes and delivers them to the specified target destination. Required permissions dsql:CreateStream Permission to create a new stream. Resources: arn:aws:dsql:region:account-id:cluster/cluster-id iam:PassRole Permission to pass the IAM role specified in the target definition to the service. Resources: ARN of the IAM role specified in targetDefinition.kinesis.roleArn kms:Decrypt Required when the cluster uses a customer managed KMS key (CMK). Permission to decrypt data using the cluster's CMK. Resources: ARN of the KMS key used by the cluster

INSERT INTO aws.dsql.streams (
targetDefinition,
ordering,
format,
tags,
clientToken,
cluster_identifier,
region
)
SELECT
'{{ targetDefinition }}' /* required */,
'{{ ordering }}' /* required */,
'{{ format }}' /* required */,
'{{ tags }}',
'{{ clientToken }}',
'{{ cluster_identifier }}',
'{{ region }}'
RETURNING
arn,
cluster_identifier,
creation_time,
format_,
ordering,
status,
stream_identifier
;

DELETE examples

Deletes a stream from a cluster.

DELETE FROM aws.dsql.streams
WHERE cluster_identifier = '{{ cluster_identifier }}' --required
AND stream_identifier = '{{ stream_identifier }}' --required
AND region = '{{ region }}' --required
AND `client-token` = '{{ client-token }}'
;