topics
Creates, updates, deletes, gets or lists a topics resource.
Overview
| Name | topics |
| Type | Resource |
| Id | aws.kafka.topics |
Fields
The following fields are returned by SELECT queries:
- describe_topic
- list_topics
| Name | Datatype | Description |
|---|---|---|
configs | string | Topic configurations encoded as a Base64 string. |
partition_count | integer | The partition count of the topic. |
replication_factor | integer | The replication factor of the topic. |
status | string | The status of the topic. (CREATING, UPDATING, DELETING, ACTIVE) |
topic_arn | string | The Amazon Resource Name (ARN) of the topic. |
topic_name | string | The Kafka topic name of the topic. |
| Name | Datatype | Description |
|---|---|---|
out_of_sync_replica_count | integer | Number of out-of-sync replicas for a topic. |
partition_count | integer | Partition count for a topic. |
replication_factor | integer | Replication factor for a topic. |
topic_arn | string | The Amazon Resource Name (ARN) of the topic. |
topic_name | string | Name for a topic. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
describe_topic | select | cluster_arn, topic_name, region | Returns topic details of this topic on a MSK cluster. | |
list_topics | select | cluster_arn, region | maxResults, nextToken, topicNameFilter | List topics in a MSK cluster. |
create_topic | insert | cluster_arn, region, TopicName, PartitionCount, ReplicationFactor | Creates a topic in the specified MSK cluster. | |
update_topic | update | cluster_arn, topic_name, region | Updates the configuration of the specified topic. | |
delete_topic | delete | cluster_arn, topic_name, region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
cluster_arn | string | The Amazon Resource Name (ARN) that uniquely identifies the cluster. |
region | string | AWS region (default: us-east-1) |
topic_name | string | The name of the topic to delete. |
maxResults | integer | The maximum number of results to return in the response. If there are more results, the response includes a NextToken parameter. |
nextToken | string | The 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. |
topicNameFilter | string | Returns topics starting with given name. |
SELECT examples
- describe_topic
- list_topics
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
;
List topics in a MSK cluster.
SELECT
out_of_sync_replica_count,
partition_count,
replication_factor,
topic_arn,
topic_name
FROM aws.kafka.topics
WHERE cluster_arn = '{{ cluster_arn }}' -- required
AND region = '{{ region }}' -- required
AND maxResults = '{{ maxResults }}'
AND nextToken = '{{ nextToken }}'
AND topicNameFilter = '{{ topicNameFilter }}'
;
INSERT examples
- create_topic
- Manifest
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
;
# Description fields are for documentation purposes
- name: topics
props:
- name: cluster_arn
value: "{{ cluster_arn }}"
description: Required parameter for the topics resource.
- name: region
value: "{{ region }}"
description: Required parameter for the topics resource.
- name: TopicName
value: "{{ TopicName }}"
- name: PartitionCount
value: {{ PartitionCount }}
- name: ReplicationFactor
value: {{ ReplicationFactor }}
- name: Configs
value: "{{ Configs }}"
UPDATE examples
- update_topic
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
- delete_topic
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
;