Creates a new MSK cluster.
The following Python 3.6 example shows how you can create a cluster that's distributed across two Availability Zones. Before you run this Python script, replace the example subnet and security-group IDs with the IDs of your subnets and security group.
When you create an MSK cluster, its brokers get evenly distributed across a number of Availability Zones that's equal to the number of subnets that you specify in the BrokerNodeGroupInfo
parameter. In the following example, you can add a third subnet to get a cluster that's distributed across three Availability Zones.
import boto3
client = boto3.client('kafka')
response = client.create_cluster(
BrokerNodeGroupInfo={
'BrokerAZDistribution': 'DEFAULT',
'ClientSubnets': [
'subnet-012345678901fedcba',
'subnet-9876543210abcdef01'
],
'InstanceType': 'kafka.m5.large',
'SecurityGroups': [
'sg-012345abcdef789789'
]
},
ClusterName='SalesCluster',
EncryptionInfo={
'EncryptionInTransit': {
'ClientBroker': 'TLS_PLAINTEXT',
'InCluster': True
}
},
EnhancedMonitoring='PER_TOPIC_PER_BROKER',
KafkaVersion='2.2.1',
NumberOfBrokerNodes=2
)
print(response)
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{
"Type" : "AWS::MSK::Cluster",
"Properties" : {
"BrokerNodeGroupInfo" : BrokerNodeGroupInfo
,
"ClientAuthentication" : ClientAuthentication
,
"ClusterName" : String
,
"ConfigurationInfo" : ConfigurationInfo
,
"CurrentVersion" : String
,
"EncryptionInfo" : EncryptionInfo
,
"EnhancedMonitoring" : String
,
"KafkaVersion" : String
,
"LoggingInfo" : LoggingInfo
,
"NumberOfBrokerNodes" : Integer
,
"OpenMonitoring" : OpenMonitoring
,
"StorageMode" : String
,
"Tags" : {Key
: Value
, ...}
}
}
YAML
Type: AWS::MSK::Cluster
Properties:
BrokerNodeGroupInfo:
BrokerNodeGroupInfo
ClientAuthentication:
ClientAuthentication
ClusterName: String
ConfigurationInfo:
ConfigurationInfo
CurrentVersion: String
EncryptionInfo:
EncryptionInfo
EnhancedMonitoring: String
KafkaVersion: String
LoggingInfo:
LoggingInfo
NumberOfBrokerNodes: Integer
OpenMonitoring:
OpenMonitoring
StorageMode: String
Tags:
Key
: Value
Properties
BrokerNodeGroupInfo
-
Information about the broker nodes in the cluster.
Required: Yes
Type: BrokerNodeGroupInfo
Update requires: No interruption
ClientAuthentication
-
Includes all client authentication related information.
Required: No
Type: ClientAuthentication
Update requires: No interruption
ClusterName
-
The name of the cluster.
Required: Yes
Type: String
Minimum:
1
Maximum:
64
Update requires: Replacement
ConfigurationInfo
-
Represents the configuration that you want MSK to use for the cluster.
Required: No
Type: ConfigurationInfo
Update requires: No interruption
CurrentVersion
-
The version of the cluster that you want to update.
Required: No
Type: String
Update requires: No interruption
EncryptionInfo
-
Includes all encryption-related information.
Required: No
Type: EncryptionInfo
Update requires: No interruption
EnhancedMonitoring
-
Specifies the level of monitoring for the MSK cluster.
Required: No
Type: String
Allowed values:
DEFAULT | PER_BROKER | PER_TOPIC_PER_BROKER | PER_TOPIC_PER_PARTITION
Minimum:
7
Maximum:
23
Update requires: No interruption
KafkaVersion
-
The version of Apache Kafka. You can use Amazon MSK to create clusters that use supported Apache Kafka versions.
Required: Yes
Type: String
Minimum:
1
Maximum:
128
Update requires: No interruption
LoggingInfo
-
Logging info details for the cluster.
Required: No
Type: LoggingInfo
Update requires: No interruption
NumberOfBrokerNodes
-
The number of broker nodes in the cluster.
Required: Yes
Type: Integer
Update requires: No interruption
OpenMonitoring
-
The settings for open monitoring.
Required: No
Type: OpenMonitoring
Update requires: No interruption
StorageMode
-
This controls storage mode for supported storage tiers.
Required: No
Type: String
Allowed values:
LOCAL | TIERED
Minimum:
5
Maximum:
6
Update requires: No interruption
-
An arbitrary set of tags (key-value pairs) for the cluster.
Required: No
Type: Object of String
Pattern:
^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$
Update requires: No interruption
Return values
Ref
When you provide the logical ID of this resource to the Ref
intrinsic function, Ref
returns the ARN of the created MSK cluster. For example, arn:aws:kafka:us-east-1:123456789012:cluster/myCluster/abcd1234-abcd-dcba-4321-a1b2abcd9f9f-2
.
Fn::GetAtt
Fn::GetAtt
returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
Arn
-
The Amazon Resource Name (ARN) of the MSK cluster.