CreateClusterV2Command

Creates a new MSK cluster.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { KafkaClient, CreateClusterV2Command } from "@aws-sdk/client-kafka"; // ES Modules import
// const { KafkaClient, CreateClusterV2Command } = require("@aws-sdk/client-kafka"); // CommonJS import
const client = new KafkaClient(config);
const input = { // CreateClusterV2Request
  ClusterName: "STRING_VALUE", // required
  Tags: { // __mapOf__string
    "<keys>": "STRING_VALUE",
  },
  Provisioned: { // ProvisionedRequest
    BrokerNodeGroupInfo: { // BrokerNodeGroupInfo
      BrokerAZDistribution: "DEFAULT",
      ClientSubnets: [ // __listOf__string // required
        "STRING_VALUE",
      ],
      InstanceType: "STRING_VALUE", // required
      SecurityGroups: [
        "STRING_VALUE",
      ],
      StorageInfo: { // StorageInfo
        EbsStorageInfo: { // EBSStorageInfo
          ProvisionedThroughput: { // ProvisionedThroughput
            Enabled: true || false,
            VolumeThroughput: Number("int"),
          },
          VolumeSize: Number("int"),
        },
      },
      ConnectivityInfo: { // ConnectivityInfo
        PublicAccess: { // PublicAccess
          Type: "STRING_VALUE",
        },
        VpcConnectivity: { // VpcConnectivity
          ClientAuthentication: { // VpcConnectivityClientAuthentication
            Sasl: { // VpcConnectivitySasl
              Scram: { // VpcConnectivityScram
                Enabled: true || false,
              },
              Iam: { // VpcConnectivityIam
                Enabled: true || false,
              },
            },
            Tls: { // VpcConnectivityTls
              Enabled: true || false,
            },
          },
        },
      },
      ZoneIds: [
        "STRING_VALUE",
      ],
    },
    ClientAuthentication: { // ClientAuthentication
      Sasl: { // Sasl
        Scram: { // Scram
          Enabled: true || false,
        },
        Iam: { // Iam
          Enabled: true || false,
        },
      },
      Tls: { // Tls
        CertificateAuthorityArnList: [
          "STRING_VALUE",
        ],
        Enabled: true || false,
      },
      Unauthenticated: { // Unauthenticated
        Enabled: true || false,
      },
    },
    ConfigurationInfo: { // ConfigurationInfo
      Arn: "STRING_VALUE", // required
      Revision: Number("long"), // required
    },
    EncryptionInfo: { // EncryptionInfo
      EncryptionAtRest: { // EncryptionAtRest
        DataVolumeKMSKeyId: "STRING_VALUE", // required
      },
      EncryptionInTransit: { // EncryptionInTransit
        ClientBroker: "TLS" || "TLS_PLAINTEXT" || "PLAINTEXT",
        InCluster: true || false,
      },
    },
    EnhancedMonitoring: "DEFAULT" || "PER_BROKER" || "PER_TOPIC_PER_BROKER" || "PER_TOPIC_PER_PARTITION",
    OpenMonitoring: { // OpenMonitoringInfo
      Prometheus: { // PrometheusInfo
        JmxExporter: { // JmxExporterInfo
          EnabledInBroker: true || false, // required
        },
        NodeExporter: { // NodeExporterInfo
          EnabledInBroker: true || false, // required
        },
      },
    },
    KafkaVersion: "STRING_VALUE", // required
    LoggingInfo: { // LoggingInfo
      BrokerLogs: { // BrokerLogs
        CloudWatchLogs: { // CloudWatchLogs
          Enabled: true || false, // required
          LogGroup: "STRING_VALUE",
        },
        Firehose: { // Firehose
          DeliveryStream: "STRING_VALUE",
          Enabled: true || false, // required
        },
        S3: { // S3
          Bucket: "STRING_VALUE",
          Enabled: true || false, // required
          Prefix: "STRING_VALUE",
        },
      },
    },
    NumberOfBrokerNodes: Number("int"), // required
    StorageMode: "LOCAL" || "TIERED",
  },
  Serverless: { // ServerlessRequest
    VpcConfigs: [ // __listOfVpcConfig // required
      { // VpcConfig
        SubnetIds: [ // required
          "STRING_VALUE",
        ],
        SecurityGroupIds: "<__listOf__string>",
      },
    ],
    ClientAuthentication: { // ServerlessClientAuthentication
      Sasl: { // ServerlessSasl
        Iam: {
          Enabled: true || false,
        },
      },
    },
  },
};
const command = new CreateClusterV2Command(input);
const response = await client.send(command);
// { // CreateClusterV2Response
//   ClusterArn: "STRING_VALUE",
//   ClusterName: "STRING_VALUE",
//   State: "ACTIVE" || "CREATING" || "DELETING" || "FAILED" || "HEALING" || "MAINTENANCE" || "REBOOTING_BROKER" || "UPDATING",
//   ClusterType: "PROVISIONED" || "SERVERLESS",
// };

CreateClusterV2Command Input

See CreateClusterV2CommandInput for more details

Parameter
Type
Description
ClusterName
Required
string | undefined

The name of the cluster.

Provisioned
ProvisionedRequest | undefined

Information about the provisioned cluster.

Serverless
ServerlessRequest | undefined

Information about the serverless cluster.

Tags
Record<string, string> | undefined

A map of tags that you want the cluster to have.

CreateClusterV2Command Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ClusterArn
string | undefined

The Amazon Resource Name (ARN) of the cluster.

ClusterName
string | undefined

The name of the MSK cluster.

ClusterType
ClusterType | undefined

The type of the cluster. The possible states are PROVISIONED or SERVERLESS.

State
ClusterState | undefined

The state of the cluster. The possible states are ACTIVE, CREATING, DELETING, FAILED, HEALING, MAINTENANCE, REBOOTING_BROKER, and UPDATING.

Throws

Name
Fault
Details
BadRequestException
client

Returns information about an error.

ConflictException
client

Returns information about an error.

ForbiddenException
client

Returns information about an error.

InternalServerErrorException
server

Returns information about an error.

ServiceUnavailableException
server

Returns information about an error.

TooManyRequestsException
client

Returns information about an error.

UnauthorizedException
client

Returns information about an error.

KafkaServiceException
Base exception class for all service exceptions from Kafka service.