Broker Count - Amazon Managed Streaming for Apache Kafka

Broker Count

The number of broker nodes in a cluster.

URI

/v1/clusters/clusterArn/nodes/count

HTTP methods

OPTIONS

Enable CORS by returning the correct headers.

Path parameters
NameTypeRequiredDescription
clusterArnStringTrue

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

Responses
Status codeResponse modelDescription
200None

Default response for CORS method

PUT

Operation ID: UpdateBrokerCount

Updates the number of broker nodes in the cluster. You can use this operation to increase or decrease the number of brokers in an existing cluster.

The following Python 3.6 example shows how you can increase the number of brokers in a cluster to 6 brokers. The update operation returns immediately, with a response that includes the Amazon Resource Name (ARN) that Amazon MSK assigns to this cluster operation. You can use that ARN to check the state of the operation. When the state changes from PENDING to UPDATE_COMPLETE, the operation is complete.

import boto3 import time client = boto3.client('kafka') update_broker_count_response = client.update_broker_count( ClusterArn='arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4', CurrentVersion='K12V3IB1VIZHHY', TargetNumberOfBrokerNodes=6 ) operation_arn = update_broker_count_response['ClusterOperationArn'] print(operation_arn) describe_cluster_operation_response = client.describe_cluster_operation(ClusterOperationArn=operation_arn) operation_state = describe_cluster_operation_response['ClusterOperationInfo']['OperationState'] print(operation_state) expanded = False while not expanded: print('Sleeping for 15 seconds before checking to see if the cluster update is done...') time.sleep(15) describe_cluster_operation_response = client.describe_cluster_operation(ClusterOperationArn=operation_arn) operation_state = describe_cluster_operation_response['ClusterOperationInfo']['OperationState'] if 'UPDATE_COMPLETE' == operation_state: expanded = True print('The cluster has 6 brokers now.')
Path parameters
NameTypeRequiredDescription
clusterArnStringTrue

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

Responses
Status codeResponse modelDescription
200 UpdateBrokerCountResponse

Successful response.

400Error

The request isn't valid because the input is incorrect. Correct your input and then submit it again.

401Error

The request is not authorized. The provided credentials couldn't be validated.

403Error

Access forbidden. Check your credentials and then retry your request.

404Error

The resource could not be found due to incorrect input. Correct the input, then retry the request.

429Error

429 response

500Error

There was an unexpected internal server error. Retrying your request might resolve the issue.

503Error

503 response

Schemas

Request bodies

{ "currentVersion": "string", "targetNumberOfBrokerNodes": integer }

Response bodies

{ "clusterArn": "string", "clusterOperationArn": "string" }
{ "invalidParameter": "string", "message": "string" }

Properties

Error

Returns information about an error.

PropertyTypeRequiredDescription
invalidParameter

string

False

The parameter that caused the error.

message

string

False

The description of the error.

UpdateBrokerCountRequest

Request body for UpdateBrokerCount. Accepts a targetNumberOfBrokerNodes value that is 2 or 3 less than the current broker node count for the cluster (for 2 and 3 AZ clusters respectively).

PropertyTypeRequiredDescription
currentVersion

string

True

The current version of the cluster.

targetNumberOfBrokerNodes

integer

True

The number of broker nodes that you want the cluster to have after this operation completes successfully.

UpdateBrokerCountResponse

Response body for UpdateBrokerCount.

PropertyTypeRequiredDescription
clusterArn

string

False

The Amazon Resource Name (ARN) of the cluster.

clusterOperationArn

string

False

The Amazon Resource Name (ARN) of the cluster operation.

See also

For more information about using this API in one of the language-specific AWS SDKs and references, see the following:

UpdateBrokerCount