Skip to content

Instantly share code, notes, and snippets.

@kavimaluskam
Last active December 11, 2022 10:04
Show Gist options
  • Save kavimaluskam/6b747b88cdc957fa6e285a9caae3b4e8 to your computer and use it in GitHub Desktop.
Save kavimaluskam/6b747b88cdc957fa6e285a9caae3b4e8 to your computer and use it in GitHub Desktop.
Cheat sheet for AWS MSK CLI
# Assign 1 public subnetID from above subnet setup
SUBNET_ID=${subnetID}
# List all kafka cluster for corrsponding region
aws kafka list-clusters --region us-east-1
# Expected output
# {
# "ClusterInfoList": [
# {
# "EncryptionInfo": {...},
# "BrokerNodeGroupInfo": {
# "BrokerAZDistribution": "DEFAULT",
# "ClientSubnets": [...],
# "StorageInfo": {...},
# "SecurityGroups": [...],
# "InstanceType": "kafka.m5.large"
# },
# "ClusterName": "data-kafka",
# "CurrentBrokerSoftwareInfo": {...},
# "CreationTime": "YYYY-MM-DDTHH:MM:SS.SSZ",
# "NumberOfBrokerNodes": 3,
# "ZookeeperConnectString": "10.0.xxx.xxx:2181,10.0.xxx.xxx:2181,10.0.xxx.xxx:2181",
# "State": "ACTIVE",
# "CurrentVersion": "...",
# "ClusterArn": "arn:aws:kafka:us-east-1:xxxxxxx:cluster/data-kafka/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-x",
# "EnhancedMonitoring": "..."
# }
# ]
# }
# Assign cluster arn from previous response
ARN=${cluster-arn}
# Get bootstrap brokers for selected cluster
aws kafka get-bootstrap-brokers --cluster-arn $arn --region us-east-1
# Expected output
# {
# "BootstrapBrokerString": "10.0.xxx.xxx:9092,10.0.xxx.xxx:9092,10.0.xxx.xxx:9092"
# }
# Assign cluster brokers connection for selected cluster
STG_BROKERS=${bootstrap-brokers-string}
# Get zookeeper and other information for selected cluster
aws kafka describe-cluster --cluster-arn $arn --region us-east-1
STG_ZK=${zookeeper-server-string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment