Kafka

Table of Contents

Client

class Kafka.Client

A low-level client representing Managed Streaming for Kafka:

import boto3

client = boto3.client('kafka')

These are the available methods:

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
create_cluster(**kwargs)

Creates a new MSK cluster.

See also: AWS API Documentation

Request Syntax

response = client.create_cluster(
    BrokerNodeGroupInfo={
        'BrokerAZDistribution': 'DEFAULT',
        'ClientSubnets': [
            'string',
        ],
        'InstanceType': 'string',
        'SecurityGroups': [
            'string',
        ],
        'StorageInfo': {
            'EbsStorageInfo': {
                'VolumeSize': 123
            }
        }
    },
    ClusterName='string',
    EncryptionInfo={
        'EncryptionAtRest': {
            'DataVolumeKMSKeyId': 'string'
        }
    },
    EnhancedMonitoring='DEFAULT'|'PER_BROKER'|'PER_TOPIC_PER_BROKER',
    KafkaVersion='string',
    NumberOfBrokerNodes=123
)
Parameters
  • BrokerNodeGroupInfo (dict) --

    [REQUIRED]

    Information about the broker nodes in the cluster.

    • BrokerAZDistribution (string) --

      The distribution of broker nodes across Availability Zones.

    • ClientSubnets (list) -- [REQUIRED]

      The list of subnets to connect to in the client virtual private cloud (VPC). AWS creates elastic network interfaces inside these subnets. Client applications use elastic network interfaces to produce and consume data. Client subnets can't be in Availability Zone us-east-1e.

      • (string) --
    • InstanceType (string) -- [REQUIRED]

      The type of Amazon EC2 instances to use for Kafka brokers. The following instance types are allowed: kafka.m5.large, kafka.m5.xlarge, kafka.m5.2xlarge, kafka.m5.4xlarge, kafka.m5.12xlarge, and kafka.m5.24xlarge.

    • SecurityGroups (list) --

      The AWS security groups to associate with the elastic network interfaces in order to specify who can connect to and communicate with the Amazon MSK cluster.

      • (string) --
    • StorageInfo (dict) --

      Contains information about storage volumes attached to MSK broker nodes.

      • EbsStorageInfo (dict) --

        EBS volume information.

        • VolumeSize (integer) --

          The size in GiB of the EBS volume for the data drive on each broker node.

  • ClusterName (string) --

    [REQUIRED]

    The name of the cluster.

  • EncryptionInfo (dict) --

    Includes all encryption-related information.

    • EncryptionAtRest (dict) --

      The data volume encryption details.

      • DataVolumeKMSKeyId (string) -- [REQUIRED]

        The AWS KMS key used for data encryption.

  • EnhancedMonitoring (string) -- Specifies the level of monitoring for the MSK cluster. The possible values are DEFAULT, PER_BROKER, and PER_TOPIC_PER_BROKER.
  • KafkaVersion (string) --

    [REQUIRED]

    The version of Apache Kafka.

  • NumberOfBrokerNodes (integer) --

    [REQUIRED]

    The number of Kafka broker nodes in the Amazon MSK cluster.

Return type

dict

Returns

Response Syntax

{
    'ClusterArn': 'string',
    'ClusterName': 'string',
    'State': 'ACTIVE'|'CREATING'|'DELETING'|'FAILED'
}

Response Structure

  • (dict) --

    • ClusterArn (string) --

      The Amazon Resource Name (ARN) of the cluster.

    • ClusterName (string) --

      The name of the MSK cluster.

    • State (string) --

      The state of the cluster. The possible states are CREATING, ACTIVE, and FAILED.

delete_cluster(**kwargs)

Deletes the MSK cluster specified by the Amazon Resource Name (ARN) in the request.

See also: AWS API Documentation

Request Syntax

response = client.delete_cluster(
    ClusterArn='string',
    CurrentVersion='string'
)
Parameters
  • ClusterArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) that uniquely identifies the cluster.

  • CurrentVersion (string) -- The current version of the MSK cluster.
Return type

dict

Returns

Response Syntax

{
    'ClusterArn': 'string',
    'State': 'ACTIVE'|'CREATING'|'DELETING'|'FAILED'
}

Response Structure

  • (dict) --

    Successful response.

    • ClusterArn (string) --

      The Amazon Resource Name (ARN) of the cluster.

    • State (string) --

      The state of the cluster. The possible states are CREATING, ACTIVE, and FAILED.

describe_cluster(**kwargs)

Returns a description of the MSK cluster whose Amazon Resource Name (ARN) is specified in the request.

See also: AWS API Documentation

Request Syntax

response = client.describe_cluster(
    ClusterArn='string'
)
Parameters
ClusterArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) that uniquely identifies the cluster.

Return type
dict
Returns
Response Syntax
{
    'ClusterInfo': {
        'BrokerNodeGroupInfo': {
            'BrokerAZDistribution': 'DEFAULT',
            'ClientSubnets': [
                'string',
            ],
            'InstanceType': 'string',
            'SecurityGroups': [
                'string',
            ],
            'StorageInfo': {
                'EbsStorageInfo': {
                    'VolumeSize': 123
                }
            }
        },
        'ClusterArn': 'string',
        'ClusterName': 'string',
        'CreationTime': datetime(2015, 1, 1),
        'CurrentBrokerSoftwareInfo': {
            'ConfigurationArn': 'string',
            'ConfigurationRevision': 'string',
            'KafkaVersion': 'string'
        },
        'CurrentVersion': 'string',
        'EncryptionInfo': {
            'EncryptionAtRest': {
                'DataVolumeKMSKeyId': 'string'
            }
        },
        'EnhancedMonitoring': 'DEFAULT'|'PER_BROKER'|'PER_TOPIC_PER_BROKER',
        'NumberOfBrokerNodes': 123,
        'State': 'ACTIVE'|'CREATING'|'DELETING'|'FAILED',
        'ZookeeperConnectString': 'string'
    }
}

Response Structure

  • (dict) --

    Successful response.

    • ClusterInfo (dict) --

      The cluster information.

      • BrokerNodeGroupInfo (dict) --

        Information about the broker nodes.

        • BrokerAZDistribution (string) --

          The distribution of broker nodes across Availability Zones.

        • ClientSubnets (list) --

          The list of subnets to connect to in the client virtual private cloud (VPC). AWS creates elastic network interfaces inside these subnets. Client applications use elastic network interfaces to produce and consume data. Client subnets can't be in Availability Zone us-east-1e.

          • (string) --
        • InstanceType (string) --

          The type of Amazon EC2 instances to use for Kafka brokers. The following instance types are allowed: kafka.m5.large, kafka.m5.xlarge, kafka.m5.2xlarge, kafka.m5.4xlarge, kafka.m5.12xlarge, and kafka.m5.24xlarge.

        • SecurityGroups (list) --

          The AWS security groups to associate with the elastic network interfaces in order to specify who can connect to and communicate with the Amazon MSK cluster.

          • (string) --
        • StorageInfo (dict) --

          Contains information about storage volumes attached to MSK broker nodes.

          • EbsStorageInfo (dict) --

            EBS volume information.

            • VolumeSize (integer) --

              The size in GiB of the EBS volume for the data drive on each broker node.

      • ClusterArn (string) --

        The Amazon Resource Name (ARN) that uniquely identifies the cluster.

      • ClusterName (string) --

        The name of the cluster.

      • CreationTime (datetime) --

        The time when the cluster was created.

      • CurrentBrokerSoftwareInfo (dict) --

        Information about the version of software currently deployed on the Kafka brokers in the cluster.

        • ConfigurationArn (string) --

          The Amazon Resource Name (ARN) of the configuration used for the cluster.

        • ConfigurationRevision (string) --

          The revision of the configuration to use.

        • KafkaVersion (string) --

          The version of Apache Kafka.

      • CurrentVersion (string) --

        The current version of the MSK cluster.

      • EncryptionInfo (dict) --

        Includes all encryption-related information.

        • EncryptionAtRest (dict) --

          The data volume encryption details.

          • DataVolumeKMSKeyId (string) --

            The AWS KMS key used for data encryption.

      • EnhancedMonitoring (string) --

        Specifies which metrics are gathered for the MSK cluster. This property has three possible values: DEFAULT, PER_BROKER, and PER_TOPIC_PER_BROKER.

      • NumberOfBrokerNodes (integer) --

        The number of Kafka broker nodes in the cluster.

      • State (string) --

        The state of the cluster. The possible states are CREATING, ACTIVE, and FAILED.

      • ZookeeperConnectString (string) --

        The connection string to use to connect to the Apache ZooKeeper cluster.

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_bootstrap_brokers(**kwargs)

A list of brokers that a client application can use to bootstrap.

See also: AWS API Documentation

Request Syntax

response = client.get_bootstrap_brokers(
    ClusterArn='string'
)
Parameters
ClusterArn (string) --

[REQUIRED]

The Amazon Resource Name (ARN) that uniquely identifies the cluster.

Return type
dict
Returns
Response Syntax
{
    'BootstrapBrokerString': 'string'
}

Response Structure

  • (dict) --

    Successful response.

    • BootstrapBrokerString (string) --

      A string containing one or more hostname:port pairs.

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_clusters(**kwargs)

Returns a list of clusters in an account.

See also: AWS API Documentation

Request Syntax

response = client.list_clusters(
    ClusterNameFilter='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • ClusterNameFilter (string) -- Specify a prefix of the name of the clusters that you want to list. The service lists all the clusters whose names start with this prefix.
  • MaxResults (integer) -- The maximum number of clusters to return in the response. If there are more clusters, the response includes a NextToken parameter.
  • NextToken (string) -- The paginated results marker. When the result of a ListClusters operation is truncated, the call returns NextToken in the response. To get another batch of clusters, provide this token in your next request.
Return type

dict

Returns

Response Syntax

{
    'ClusterInfoList': [
        {
            'BrokerNodeGroupInfo': {
                'BrokerAZDistribution': 'DEFAULT',
                'ClientSubnets': [
                    'string',
                ],
                'InstanceType': 'string',
                'SecurityGroups': [
                    'string',
                ],
                'StorageInfo': {
                    'EbsStorageInfo': {
                        'VolumeSize': 123
                    }
                }
            },
            'ClusterArn': 'string',
            'ClusterName': 'string',
            'CreationTime': datetime(2015, 1, 1),
            'CurrentBrokerSoftwareInfo': {
                'ConfigurationArn': 'string',
                'ConfigurationRevision': 'string',
                'KafkaVersion': 'string'
            },
            'CurrentVersion': 'string',
            'EncryptionInfo': {
                'EncryptionAtRest': {
                    'DataVolumeKMSKeyId': 'string'
                }
            },
            'EnhancedMonitoring': 'DEFAULT'|'PER_BROKER'|'PER_TOPIC_PER_BROKER',
            'NumberOfBrokerNodes': 123,
            'State': 'ACTIVE'|'CREATING'|'DELETING'|'FAILED',
            'ZookeeperConnectString': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    Successful response.

    • ClusterInfoList (list) --

      Information on each of the MSK clusters in the response.

      • (dict) --

        Returns information about a cluster.

        • BrokerNodeGroupInfo (dict) --

          Information about the broker nodes.

          • BrokerAZDistribution (string) --

            The distribution of broker nodes across Availability Zones.

          • ClientSubnets (list) --

            The list of subnets to connect to in the client virtual private cloud (VPC). AWS creates elastic network interfaces inside these subnets. Client applications use elastic network interfaces to produce and consume data. Client subnets can't be in Availability Zone us-east-1e.

            • (string) --
          • InstanceType (string) --

            The type of Amazon EC2 instances to use for Kafka brokers. The following instance types are allowed: kafka.m5.large, kafka.m5.xlarge, kafka.m5.2xlarge, kafka.m5.4xlarge, kafka.m5.12xlarge, and kafka.m5.24xlarge.

          • SecurityGroups (list) --

            The AWS security groups to associate with the elastic network interfaces in order to specify who can connect to and communicate with the Amazon MSK cluster.

            • (string) --
          • StorageInfo (dict) --

            Contains information about storage volumes attached to MSK broker nodes.

            • EbsStorageInfo (dict) --

              EBS volume information.

              • VolumeSize (integer) --

                The size in GiB of the EBS volume for the data drive on each broker node.

        • ClusterArn (string) --

          The Amazon Resource Name (ARN) that uniquely identifies the cluster.

        • ClusterName (string) --

          The name of the cluster.

        • CreationTime (datetime) --

          The time when the cluster was created.

        • CurrentBrokerSoftwareInfo (dict) --

          Information about the version of software currently deployed on the Kafka brokers in the cluster.

          • ConfigurationArn (string) --

            The Amazon Resource Name (ARN) of the configuration used for the cluster.

          • ConfigurationRevision (string) --

            The revision of the configuration to use.

          • KafkaVersion (string) --

            The version of Apache Kafka.

        • CurrentVersion (string) --

          The current version of the MSK cluster.

        • EncryptionInfo (dict) --

          Includes all encryption-related information.

          • EncryptionAtRest (dict) --

            The data volume encryption details.

            • DataVolumeKMSKeyId (string) --

              The AWS KMS key used for data encryption.

        • EnhancedMonitoring (string) --

          Specifies which metrics are gathered for the MSK cluster. This property has three possible values: DEFAULT, PER_BROKER, and PER_TOPIC_PER_BROKER.

        • NumberOfBrokerNodes (integer) --

          The number of Kafka broker nodes in the cluster.

        • State (string) --

          The state of the cluster. The possible states are CREATING, ACTIVE, and FAILED.

        • ZookeeperConnectString (string) --

          The connection string to use to connect to the Apache ZooKeeper cluster.

    • NextToken (string) --

      The paginated results marker. When the result of a ListClusters operation is truncated, the call returns NextToken in the response. To get another batch of clusters, provide this token in your next request.

list_nodes(**kwargs)

Returns a list of the broker nodes in the cluster.

See also: AWS API Documentation

Request Syntax

response = client.list_nodes(
    ClusterArn='string',
    MaxResults=123,
    NextToken='string'
)
Parameters
  • ClusterArn (string) --

    [REQUIRED]

    The Amazon Resource Name (ARN) that uniquely identifies the cluster.

  • MaxResults (integer) -- The maximum number of clusters to return in the response. If there are more clusters, the response includes a NextToken parameter.
  • NextToken (string) -- The paginated results marker. When the result of a ListClusters operation is truncated, the call returns NextToken in the response. To get another batch of clusters, provide this token in your next request.
Return type

dict

Returns

Response Syntax

{
    'NextToken': 'string',
    'NodeInfoList': [
        {
            'AddedToClusterTime': 'string',
            'BrokerNodeInfo': {
                'AttachedENIId': 'string',
                'BrokerId': 123.0,
                'ClientSubnet': 'string',
                'ClientVpcIpAddress': 'string',
                'CurrentBrokerSoftwareInfo': {
                    'ConfigurationArn': 'string',
                    'ConfigurationRevision': 'string',
                    'KafkaVersion': 'string'
                }
            },
            'InstanceType': 'string',
            'NodeARN': 'string',
            'NodeType': 'BROKER',
            'ZookeeperNodeInfo': {
                'AttachedENIId': 'string',
                'ClientVpcIpAddress': 'string',
                'ZookeeperId': 123.0,
                'ZookeeperVersion': 'string'
            }
        },
    ]
}

Response Structure

  • (dict) --

    Successful response.

    • NextToken (string) --

      The paginated results marker. When the result of a ListNodes operation is truncated, the call returns NextToken in the response. To get another batch of nodes, provide this token in your next request.

    • NodeInfoList (list) --

      List containing a NodeInfo object.

      • (dict) --

        The node information object.

        • AddedToClusterTime (string) --

          The start time.

        • BrokerNodeInfo (dict) --

          The broker node info.

          • AttachedENIId (string) --

            The attached elastic network interface of the broker.

          • BrokerId (float) --

            The ID of the broker.

          • ClientSubnet (string) --

            The client subnet to which this broker node belongs.

          • ClientVpcIpAddress (string) --

            The virtual private cloud (VPC) of the client.

          • CurrentBrokerSoftwareInfo (dict) --

            Information about the version of software currently deployed on the Kafka brokers in the cluster.

            • ConfigurationArn (string) --

              The Amazon Resource Name (ARN) of the configuration used for the cluster.

            • ConfigurationRevision (string) --

              The revision of the configuration to use.

            • KafkaVersion (string) --

              The version of Apache Kafka.

        • InstanceType (string) --

          The instance type.

        • NodeARN (string) --

          The Amazon Resource Name (ARN) of the node.

        • NodeType (string) --

          The node type.

        • ZookeeperNodeInfo (dict) --

          The ZookeeperNodeInfo.

          • AttachedENIId (string) --

            The attached elastic network interface of the broker.

          • ClientVpcIpAddress (string) --

            The virtual private cloud (VPC) IP address of the client.

          • ZookeeperId (float) --

            The role-specific ID for Zookeeper.

          • ZookeeperVersion (string) --

            The version of Zookeeper.

Paginators

The available paginators are: