Skip to content

Commit

Permalink
Merge pull request aws#4586 from bisdavid/kafka-10-07
Browse files Browse the repository at this point in the history
New CLI examples for Kafka service
  • Loading branch information
jamesls authored Oct 11, 2019
2 parents 193e2b9 + cf3b8b9 commit 3626d26
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
31 changes: 31 additions & 0 deletions awscli/examples/kafka/create-cluster.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
**To create an Amazon MSK cluster**

The following ``create-cluster`` example creates an MSK cluster named ``MessagingCluster`` with three broker nodes. A JSON file named ``brokernodegroupinfo.json`` specifies the three subnets over which you want Amazon MSK to distribute the broker nodes. This example doesn't specify the monitoring level, so the cluster gets the ``DEFAULT`` level. ::

aws kafka create-cluster \
--cluster-name "MessagingCluster" \
--broker-node-group-info file://brokernodegroupinfo.json \
--kafka-version "2.2.1" \
--number-of-broker-nodes 3

Contents of ``brokernodegroupinfo.json``::

{
"InstanceType": "kafka.m5.xlarge",
"BrokerAZDistribution": "DEFAULT",
"ClientSubnets": [
"subnet-0123456789111abcd",
"subnet-0123456789222abcd",
"subnet-0123456789333abcd"
]
}

Output::

{
"ClusterArn": "arn:aws:kafka:us-west-2:123456789012:cluster/MessagingCluster/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2",
"ClusterName": "MessagingCluster",
"State": "CREATING"
}

For more information, see `Create an Amazon MSK Cluster <https://docs.aws.amazon.com/msk/latest/developerguide/msk-create-cluster.html>`__ in the *Amazon Managed Streaming for Apache Kafka*.
32 changes: 32 additions & 0 deletions awscli/examples/kafka/create-configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
**To create a custom Amazon MSK configuration**

The following ``create-configuration`` example creates a custom MSK configuration with the server properties that are specified in the input file. ::

aws kafka create-configuration \
--name "CustomConfiguration" \
--description "Topic autocreation enabled; Apache ZooKeeper timeout 2000 ms; Log rolling 604800000 ms." \
--kafka-versions "2.2.1" \
--server-properties file://configuration.txt

Contents of ``configuration.txt``::

auto.create.topics.enable = true
zookeeper.connection.timeout.ms = 2000
log.roll.ms = 604800000

This command produces no output.
Output::

{
"Arn": "arn:aws:kafka:us-west-2:123456789012:configuration/CustomConfiguration/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2",
"CreationTime": "2019-10-09T15:26:05.548Z",
"LatestRevision":
{
"CreationTime": "2019-10-09T15:26:05.548Z",
"Description": "Topic autocreation enabled; Apache ZooKeeper timeout 2000 ms; Log rolling 604800000 ms.",
"Revision": 1
},
"Name": "CustomConfiguration"
}

For more information, see `Amazon MSK Configuration Operations <https://docs.aws.amazon.com/msk/latest/developerguide/msk-configuration-operations.html>`__ in the *Amazon Managed Streaming for Apache Kafka Developer Guide*.
18 changes: 18 additions & 0 deletions awscli/examples/kafka/update-broker-storage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
**To update the EBS storage for brokers**

The following ``update-broker-storage`` example updates the amount of EBS storage for all the brokers in the cluster. Amazon MSK sets the target storage amount for each broker to the amount specified in the example. You can get the current version of the cluster by describing the cluster or by listing all of the clusters. ::


aws kafka update-broker-storage \
--cluster-arn "arn:aws:kafka:us-west-2:123456789012:cluster/MessagingCluster/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2" \
--current-version "K21V3IB1VIZYYH" \
--target-broker-ebs-volume-info "KafkaBrokerNodeId=ALL,VolumeSizeGB=1100"

The output returns an ARN for this ``update-broker-storage`` operation. To determine if this operation is complete, use the ``describe-cluster-operation`` command with this ARN as input. ::

{
"ClusterArn": "arn:aws:kafka:us-west-2:123456789012:cluster/MessagingCluster/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2",
"ClusterOperationArn": "arn:aws:kafka:us-west-2:123456789012:cluster-operation/V123450123/a1b2c3d4-1234-abcd-cdef-22222EXAMPLE-2/a1b2c3d4-abcd-1234-bcde-33333EXAMPLE"
}

For more information, see `Update the EBS Storage for Brokers <https://docs.aws.amazon.com/msk/latest/developerguide/msk-update-storage.html>`__ in the *Amazon Managed Streaming for Apache Kafka Developer Guide*.
25 changes: 25 additions & 0 deletions awscli/examples/kafka/update-cluster-configuration.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**To update the configuration of an Amazon MSK cluster**

The following ``update-cluster-configuration`` example updates the configuration of the specified existing MSK cluster. It uses a custom MSK configuration. ::


aws kafka update-cluster-configuration \
--cluster-arn "arn:aws:kafka:us-west-2:123456789012:cluster/MessagingCluster/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2" \
--configuration-info file://configuration-info.json \
--current-version "K21V3IB1VIZYYH"

Contents of ``configuration-info.json``::

{
"Arn": "arn:aws:kafka:us-west-2:123456789012:configuration/CustomConfiguration/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2",
"Revision": 1
}

The output returns an ARN for this ``update-cluster-configuration`` operation. To determine if this operation is complete, use the ``describe-cluster-operation`` command with this ARN as input. ::

{
"ClusterArn": "arn:aws:kafka:us-west-2:123456789012:cluster/MessagingCluster/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE-2",
"ClusterOperationArn": "arn:aws:kafka:us-west-2:123456789012:cluster-operation/V123450123/a1b2c3d4-1234-abcd-cdef-22222EXAMPLE-2/a1b2c3d4-abcd-1234-bcde-33333EXAMPLE"
}

For more information, see `Update the Configuration of an Amazon MSK Cluster <https://docs.aws.amazon.com/msk/latest/developerguide/msk-update-cluster-cofig.html>`__ in the *Amazon Managed Streaming for Apache Kafka Developer Guide*.

0 comments on commit 3626d26

Please sign in to comment.