Class Cluster

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IConstruct, IDependable, IResource, IConnectable, ICluster, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:42.702Z") @Stability(Experimental) public class Cluster extends Resource implements ICluster
(experimental) Create a MSK Cluster.

Example:

 Vpc vpc;
 Cluster cluster = Cluster.Builder.create(this, "cluster")
         .clusterName("myCluster")
         .kafkaVersion(KafkaVersion.V2_8_1)
         .vpc(vpc)
         .encryptionInTransit(EncryptionInTransitConfig.builder()
                 .clientBroker(ClientBrokerEncryption.TLS)
                 .build())
         .clientAuthentication(ClientAuthentication.sasl(SaslAuthProps.builder()
                 .scram(true)
                 .build()))
         .build();
 
  • Constructor Details

    • Cluster

      protected Cluster(software.amazon.jsii.JsiiObjectRef objRef)
    • Cluster

      protected Cluster(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Cluster

      @Stability(Experimental) public Cluster(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ClusterProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromClusterArn

      @Stability(Experimental) @NotNull public static ICluster fromClusterArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String clusterArn)
      (experimental) Reference an existing cluster, defined outside of the CDK code, by name.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      clusterArn - This parameter is required.
    • addUser

      @Stability(Experimental) public void addUser(@NotNull @NotNull String... usernames)
      (experimental) 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.

      Parameters:
      usernames -
      • username(s) to register with the cluster.
      This parameter is required.
    • getBootstrapBrokers

      @Stability(Experimental) @NotNull public String getBootstrapBrokers()
      (experimental) 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

      Returns:
      • A string containing one or more hostname:port pairs.
    • getBootstrapBrokersSaslScram

      @Stability(Experimental) @NotNull public String getBootstrapBrokersSaslScram()
      (experimental) 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

      Returns:
      • A string containing one or more dns name (or IP) and SASL SCRAM port pairs.
    • getBootstrapBrokersTls

      @Stability(Experimental) @NotNull public String getBootstrapBrokersTls()
      (experimental) 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

      Returns:
      • A string containing one or more DNS names (or IP) and TLS port pairs.
    • getClusterArn

      @Stability(Experimental) @NotNull public String getClusterArn()
      (experimental) The ARN of cluster.
      Specified by:
      getClusterArn in interface ICluster
    • getClusterName

      @Stability(Experimental) @NotNull public String getClusterName()
      (experimental) The physical name of the cluster.
      Specified by:
      getClusterName in interface ICluster
    • getConnections

      @Stability(Experimental) @NotNull public Connections getConnections()
      (experimental) Manages connections for the cluster.
      Specified by:
      getConnections in interface IConnectable
    • getZookeeperConnectionString

      @Stability(Experimental) @NotNull public String getZookeeperConnectionString()
      (experimental) Get the ZooKeeper Connection string.

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

      Returns:
      • The connection string to use to connect to the Apache ZooKeeper cluster.
    • getZookeeperConnectionStringTls

      @Stability(Experimental) @NotNull public String getZookeeperConnectionStringTls()
      (experimental) 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

      Returns:
      • The connection string to use to connect to zookeeper cluster on TLS port.
    • getSaslScramAuthenticationKey

      @Stability(Experimental) @Nullable public IKey getSaslScramAuthenticationKey()
      (experimental) Key used to encrypt SASL/SCRAM users.