Skip to main content

topics

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

Overview

Nametopics
TypeResource
Idaws.kafka.topics

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
configsstringTopic configurations encoded as a Base64 string.
partition_countintegerThe partition count of the topic.
replication_factorintegerThe replication factor of the topic.
statusstringThe status of the topic. (CREATING, UPDATING, DELETING, ACTIVE)
topic_arnstringThe Amazon Resource Name (ARN) of the topic.
topic_namestringThe Kafka topic name of the topic.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_topicselectcluster_arn, topic_name, regionReturns topic details of this topic on a MSK cluster.
list_topicsselectcluster_arn, regionmaxResults, nextToken, topicNameFilterList topics in a MSK cluster.
create_topicinsertcluster_arn, region, TopicName, PartitionCount, ReplicationFactorCreates a topic in the specified MSK cluster.
update_topicupdatecluster_arn, topic_name, regionUpdates the configuration of the specified topic.
delete_topicdeletecluster_arn, topic_name, regionDeletes a topic in the specified MSK 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_arnstringThe Amazon Resource Name (ARN) that uniquely identifies the cluster.
regionstringAWS region (default: us-east-1)
topic_namestringThe name of the topic to delete.
maxResultsintegerThe maximum number of results to return in the response. If there are more results, the response includes a NextToken parameter.
nextTokenstringThe paginated results marker. When the result of the operation is truncated, the call returns NextToken in the response. To get the next batch, provide this token in your next request.
topicNameFilterstringReturns topics starting with given name.

SELECT examples

Returns topic details of this topic on a MSK cluster.

SELECT
configs,
partition_count,
replication_factor,
status,
topic_arn,
topic_name
FROM aws.kafka.topics
WHERE cluster_arn = '{{ cluster_arn }}' -- required
AND topic_name = '{{ topic_name }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a topic in the specified MSK cluster.

INSERT INTO aws.kafka.topics (
TopicName,
PartitionCount,
ReplicationFactor,
Configs,
cluster_arn,
region
)
SELECT
'{{ TopicName }}' /* required */,
{{ PartitionCount }} /* required */,
{{ ReplicationFactor }} /* required */,
'{{ Configs }}',
'{{ cluster_arn }}',
'{{ region }}'
RETURNING
status,
topic_arn,
topic_name
;

UPDATE examples

Updates the configuration of the specified topic.

UPDATE aws.kafka.topics
SET
Configs = '{{ Configs }}',
PartitionCount = {{ PartitionCount }}
WHERE
cluster_arn = '{{ cluster_arn }}' --required
AND topic_name = '{{ topic_name }}' --required
AND region = '{{ region }}' --required
RETURNING
status,
topic_arn,
topic_name;

DELETE examples

Deletes a topic in the specified MSK cluster.

DELETE FROM aws.kafka.topics
WHERE cluster_arn = '{{ cluster_arn }}' --required
AND topic_name = '{{ topic_name }}' --required
AND region = '{{ region }}' --required
;