createCluster method

Future<CreateClusterResponse> createCluster({
  1. required String clusterName,
  2. required String iamRoleArn,
  3. required String nodeType,
  4. required int replicationFactor,
  5. List<String>? availabilityZones,
  6. String? description,
  7. String? notificationTopicArn,
  8. String? parameterGroupName,
  9. String? preferredMaintenanceWindow,
  10. SSESpecification? sSESpecification,
  11. List<String>? securityGroupIds,
  12. String? subnetGroupName,
  13. List<Tag>? tags,
})

Creates a DAX cluster. All nodes in the cluster run the same DAX caching software.

May throw ClusterAlreadyExistsFault. May throw InvalidClusterStateFault. May throw InsufficientClusterCapacityFault. May throw SubnetGroupNotFoundFault. May throw InvalidParameterGroupStateFault. May throw ParameterGroupNotFoundFault. May throw ClusterQuotaForCustomerExceededFault. May throw NodeQuotaForClusterExceededFault. May throw NodeQuotaForCustomerExceededFault. May throw InvalidVPCNetworkStateFault. May throw TagQuotaPerResourceExceeded. May throw ServiceLinkedRoleNotFoundFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.

Parameter clusterName : The cluster identifier. This parameter is stored as a lowercase string.

Constraints:

  • A name must contain from 1 to 20 alphanumeric characters or hyphens.
  • The first character must be a letter.
  • A name cannot end with a hyphen or contain two consecutive hyphens.

Parameter iamRoleArn : A valid Amazon Resource Name (ARN) that identifies an IAM role. At runtime, DAX will assume this role and use the role's permissions to access DynamoDB on your behalf.

Parameter nodeType : The compute and memory capacity of the nodes in the cluster.

Parameter replicationFactor : The number of nodes in the DAX cluster. A replication factor of 1 will create a single-node cluster, without any read replicas. For additional fault tolerance, you can create a multiple node cluster with one or more read replicas. To do this, set ReplicationFactor to a number between 3 (one primary and two read replicas) and 10 (one primary and nine read replicas). If the AvailabilityZones parameter is provided, its length must equal the ReplicationFactor.

Parameter availabilityZones : The Availability Zones (AZs) in which the cluster nodes will reside after the cluster has been created or updated. If provided, the length of this list must equal the ReplicationFactor parameter. If you omit this parameter, DAX will spread the nodes across Availability Zones for the highest availability.

Parameter description : A description of the cluster.

Parameter notificationTopicArn : The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications will be sent.

Parameter parameterGroupName : The parameter group to be associated with the DAX cluster.

Parameter preferredMaintenanceWindow : Specifies the weekly time range during which maintenance on the DAX cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Valid values for ddd are:

  • sun
  • mon
  • tue
  • wed
  • thu
  • fri
  • sat
Example: sun:05:00-sun:09:00

Parameter sSESpecification : Represents the settings used to enable server-side encryption on the cluster.

Parameter securityGroupIds : A list of security group IDs to be assigned to each node in the DAX cluster. (Each of the security group ID is system-generated.)

If this parameter is not specified, DAX assigns the default VPC security group to each node.

Parameter subnetGroupName : The name of the subnet group to be used for the replication group.

Parameter tags : A set of tags to associate with the DAX cluster.

Implementation

Future<CreateClusterResponse> createCluster({
  required String clusterName,
  required String iamRoleArn,
  required String nodeType,
  required int replicationFactor,
  List<String>? availabilityZones,
  String? description,
  String? notificationTopicArn,
  String? parameterGroupName,
  String? preferredMaintenanceWindow,
  SSESpecification? sSESpecification,
  List<String>? securityGroupIds,
  String? subnetGroupName,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(clusterName, 'clusterName');
  ArgumentError.checkNotNull(iamRoleArn, 'iamRoleArn');
  ArgumentError.checkNotNull(nodeType, 'nodeType');
  ArgumentError.checkNotNull(replicationFactor, 'replicationFactor');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonDAXV3.CreateCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      'IamRoleArn': iamRoleArn,
      'NodeType': nodeType,
      'ReplicationFactor': replicationFactor,
      if (availabilityZones != null) 'AvailabilityZones': availabilityZones,
      if (description != null) 'Description': description,
      if (notificationTopicArn != null)
        'NotificationTopicArn': notificationTopicArn,
      if (parameterGroupName != null)
        'ParameterGroupName': parameterGroupName,
      if (preferredMaintenanceWindow != null)
        'PreferredMaintenanceWindow': preferredMaintenanceWindow,
      if (sSESpecification != null) 'SSESpecification': sSESpecification,
      if (securityGroupIds != null) 'SecurityGroupIds': securityGroupIds,
      if (subnetGroupName != null) 'SubnetGroupName': subnetGroupName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateClusterResponse.fromJson(jsonResponse.body);
}