class Cluster (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.MSK.Alpha.Cluster |
Go | github.com/aws/aws-cdk-go/awscdkmskalpha/v2#Cluster |
Java | software.amazon.awscdk.services.msk.alpha.Cluster |
Python | aws_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
Cluster
Props
Construct Props
Name | Type | Description |
---|---|---|
cluster | string | The physical name of the cluster. |
kafka | Kafka | The version of Apache Kafka. |
vpc | IVpc | Defines the virtual networking environment for this cluster. |
client | Client | Configuration properties for client authentication. |
configuration | Cluster | The Amazon MSK configuration to use for the cluster. |
ebs | Ebs | Information about storage volumes attached to MSK broker nodes. |
encryption | Encryption | Config details for encryption in transit. |
instance | Instance | The EC2 instance type that you want Amazon MSK to use when it creates your brokers. |
logging? | Broker | Configure your MSK cluster to send broker logs to different destination types. |
monitoring? | Monitoring | Cluster monitoring configuration. |
number | number | Number of Apache Kafka brokers deployed in each Availability Zone. |
removal | Removal | What to do when this resource is deleted from a stack. |
security | ISecurity [] | 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. |
storage | Storage | This controls storage mode for supported storage tiers. |
vpc | Subnet | Where to place the nodes within the VPC. |
clusterName
Type:
string
The physical name of the cluster.
kafkaVersion
Type:
Kafka
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:
Client
(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:
Cluster
(optional, default: none)
The Amazon MSK configuration to use for the cluster.
ebsStorageInfo?
Type:
Ebs
(optional, default: 1000 GiB EBS volume)
Information about storage volumes attached to MSK broker nodes.
encryptionInTransit?
Type:
Encryption
(optional, default: enabled)
Config details for encryption in transit.
instanceType?
Type:
Instance
(optional, default: kafka.m5.large)
The EC2 instance type that you want Amazon MSK to use when it creates your brokers.
logging?
Type:
Broker
(optional, default: disabled)
Configure your MSK cluster to send broker logs to different destination types.
monitoring?
Type:
Monitoring
(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:
Removal
(optional, default: RemovalPolicy.RETAIN)
What to do when this resource is deleted from a stack.
securityGroups?
Type:
ISecurity
[]
(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.
storageMode?
Type:
Storage
(optional, default: StorageMode.LOCAL)
This controls storage mode for supported storage tiers.
See also: https://docs.aws.amazon.com/msk/latest/developerguide/msk-tiered-storage.html
vpcSubnets?
Type:
Subnet
(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
Name | Type | Description |
---|---|---|
bootstrap | string | Get the list of brokers that a client application can use to bootstrap. |
bootstrap | string | Get the list of brokers that a SASL/IAM authenticated client application can use to bootstrap. |
bootstrap | string | Get the list of brokers that a SASL/SCRAM authenticated client application can use to bootstrap. |
bootstrap | string | Get the list of brokers that a TLS authenticated client application can use to bootstrap. |
cluster | string | The ARN of cluster. |
cluster | string | The physical name of the cluster. |
connections | Connections | Manages connections for the cluster. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
zookeeper | string | Get the ZooKeeper Connection string. |
zookeeper | string | Get the ZooKeeper Connection string for a TLS enabled cluster. |
sasl | IKey | Key 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:
Resource
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
Name | Description |
---|---|
add | A list of usersnames to register with the cluster. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Reference an existing cluster, defined outside of the CDK code, by name. |
User(...usernames)
addpublic 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.
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
ClusterArn(scope, id, clusterArn)
static frompublic static fromClusterArn(scope: Construct, id: string, clusterArn: string): ICluster
Parameters
- scope
Construct
- id
string
- clusterArn
string
Returns
Reference an existing cluster, defined outside of the CDK code, by name.