@aws-cdk_aws-msk-alpha.Cluster

class Cluster (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.MSK.Alpha.Cluster
Gogithub.com/aws/aws-cdk-go/awscdkmskalpha/v2#Cluster
Javasoftware.amazon.awscdk.services.msk.alpha.Cluster
Pythonaws_cdk.aws_msk_alpha.Cluster
TypeScript (source)@aws-cdk/aws-msk-alpha ยป Cluster

Implements IConstruct, IDependable, IResource, ICluster, IConnectable

Create a MSK Cluster.

Example

declare const vpc: ec2.Vpc;
const cluster = new msk.Cluster(this, 'cluster', {
  clusterName: 'myCluster',
  kafkaVersion: msk.KafkaVersion.V2_8_1,
  vpc,
  encryptionInTransit: {
    clientBroker: msk.ClientBrokerEncryption.TLS,
  },
  clientAuthentication: msk.ClientAuthentication.sasl({
    scram: true,
  }),
});

Initializer

new Cluster(scope: Construct, id: string, props: ClusterProps)

Parameters

  • scope Construct
  • id string
  • props ClusterProps

Construct Props

NameTypeDescription
clusterName๐Ÿ”นstringThe physical name of the cluster.
kafkaVersion๐Ÿ”นKafkaVersionThe version of Apache Kafka.
vpc๐Ÿ”นIVpcDefines the virtual networking environment for this cluster.
clientAuthentication?๐Ÿ”นClientAuthenticationConfiguration properties for client authentication.
configurationInfo?๐Ÿ”นClusterConfigurationInfoThe Amazon MSK configuration to use for the cluster.
ebsStorageInfo?๐Ÿ”นEbsStorageInfoInformation about storage volumes attached to MSK broker nodes.
encryptionInTransit?๐Ÿ”นEncryptionInTransitConfigConfig details for encryption in transit.
instanceType?๐Ÿ”นInstanceTypeThe EC2 instance type that you want Amazon MSK to use when it creates your brokers.
logging?๐Ÿ”นBrokerLoggingConfigure your MSK cluster to send broker logs to different destination types.
monitoring?๐Ÿ”นMonitoringConfigurationCluster monitoring configuration.
numberOfBrokerNodes?๐Ÿ”นnumberNumber of Apache Kafka brokers deployed in each Availability Zone.
removalPolicy?๐Ÿ”นRemovalPolicyWhat to do when this resource is deleted from a stack.
securityGroups?๐Ÿ”นISecurityGroup[]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.
vpcSubnets?๐Ÿ”นSubnetSelectionWhere to place the nodes within the VPC.

clusterName๐Ÿ”น

Type: string

The physical name of the cluster.


kafkaVersion๐Ÿ”น

Type: KafkaVersion

The version of Apache Kafka.


vpc๐Ÿ”น

Type: IVpc

Defines the virtual networking environment for this cluster.

Must have at least 2 subnets in two different AZs.


clientAuthentication?๐Ÿ”น

Type: ClientAuthentication (optional, default: disabled)

Configuration properties for client authentication.

MSK supports using private TLS certificates or SASL/SCRAM to authenticate the identity of clients.


configurationInfo?๐Ÿ”น

Type: ClusterConfigurationInfo (optional, default: none)

The Amazon MSK configuration to use for the cluster.


ebsStorageInfo?๐Ÿ”น

Type: EbsStorageInfo (optional, default: 1000 GiB EBS volume)

Information about storage volumes attached to MSK broker nodes.


encryptionInTransit?๐Ÿ”น

Type: EncryptionInTransitConfig (optional, default: enabled)

Config details for encryption in transit.


instanceType?๐Ÿ”น

Type: InstanceType (optional, default: kafka.m5.large)

The EC2 instance type that you want Amazon MSK to use when it creates your brokers.

See also: https://docs.aws.amazon.com/msk/latest/developerguide/msk-create-cluster.html#broker-instance-types


logging?๐Ÿ”น

Type: BrokerLogging (optional, default: disabled)

Configure your MSK cluster to send broker logs to different destination types.


monitoring?๐Ÿ”น

Type: MonitoringConfiguration (optional, default: DEFAULT monitoring level)

Cluster monitoring configuration.


numberOfBrokerNodes?๐Ÿ”น

Type: number (optional, default: 1)

Number of Apache Kafka brokers deployed in each Availability Zone.


removalPolicy?๐Ÿ”น

Type: RemovalPolicy (optional, default: RemovalPolicy.RETAIN)

What to do when this resource is deleted from a stack.


securityGroups?๐Ÿ”น

Type: ISecurityGroup[] (optional, default: create new security group)

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.


vpcSubnets?๐Ÿ”น

Type: SubnetSelection (optional, default: the Vpc default strategy if not specified.)

Where to place the nodes within the VPC.

Amazon MSK distributes the broker nodes evenly across the subnets that you specify. The subnets that you specify must be in distinct Availability Zones. Client subnets can't be in Availability Zone us-east-1e.

Properties

NameTypeDescription
bootstrapBrokers๐Ÿ”นstringGet the list of brokers that a client application can use to bootstrap.
bootstrapBrokersSaslIam๐Ÿ”นstringGet the list of brokers that a SASL/IAM authenticated client application can use to bootstrap.
bootstrapBrokersSaslScram๐Ÿ”นstringGet the list of brokers that a SASL/SCRAM authenticated client application can use to bootstrap.
bootstrapBrokersTls๐Ÿ”นstringGet the list of brokers that a TLS authenticated client application can use to bootstrap.
clusterArn๐Ÿ”นstringThe ARN of cluster.
clusterName๐Ÿ”นstringThe physical name of the cluster.
connections๐Ÿ”นConnectionsManages connections for the cluster.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.
zookeeperConnectionString๐Ÿ”นstringGet the ZooKeeper Connection string.
zookeeperConnectionStringTls๐Ÿ”นstringGet the ZooKeeper Connection string for a TLS enabled cluster.
saslScramAuthenticationKey?๐Ÿ”นIKeyKey used to encrypt SASL/SCRAM users.

bootstrapBrokers๐Ÿ”น

Type: string

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

Uses a Custom Resource to make an API call to getBootstrapBrokers using the Javascript SDK


bootstrapBrokersSaslIam๐Ÿ”น

Type: string

Get the list of brokers that a SASL/IAM authenticated client application can use to bootstrap.

Uses a Custom Resource to make an API call to getBootstrapBrokers using the Javascript SDK


bootstrapBrokersSaslScram๐Ÿ”น

Type: string

Get the list of brokers that a SASL/SCRAM authenticated client application can use to bootstrap.

Uses a Custom Resource to make an API call to getBootstrapBrokers using the Javascript SDK


bootstrapBrokersTls๐Ÿ”น

Type: string

Get the list of brokers that a TLS authenticated client application can use to bootstrap.

Uses a Custom Resource to make an API call to getBootstrapBrokers using the Javascript SDK


clusterArn๐Ÿ”น

Type: string

The ARN of cluster.


clusterName๐Ÿ”น

Type: string

The physical name of the cluster.


connections๐Ÿ”น

Type: Connections

Manages connections for the cluster.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


zookeeperConnectionString๐Ÿ”น

Type: string

Get the ZooKeeper Connection string.

Uses a Custom Resource to make an API call to describeCluster using the Javascript SDK


zookeeperConnectionStringTls๐Ÿ”น

Type: string

Get the ZooKeeper Connection string for a TLS enabled cluster.

Uses a Custom Resource to make an API call to describeCluster using the Javascript SDK


saslScramAuthenticationKey?๐Ÿ”น

Type: IKey (optional)

Key used to encrypt SASL/SCRAM users.

Methods

NameDescription
addUser(...usernames)๐Ÿ”นA list of usersnames to register with the cluster.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromClusterArn(scope, id, clusterArn)๐Ÿ”นReference an existing cluster, defined outside of the CDK code, by name.

addUser(...usernames)๐Ÿ”น

public addUser(...usernames: string[]): void

Parameters

  • usernames string โ€” - username(s) to register with the cluster.

A list of usersnames to register with the cluster.

The password will automatically be generated using Secrets Manager and the { username, password } JSON object stored in Secrets Manager as AmazonMSK_username.

Must be using the SASL/SCRAM authentication mechanism.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromClusterArn(scope, id, clusterArn)๐Ÿ”น

public static fromClusterArn(scope: Construct, id: string, clusterArn: string): ICluster

Parameters

  • scope Construct
  • id string
  • clusterArn string

Returns

  • ICluster

Reference an existing cluster, defined outside of the CDK code, by name.