createCluster method

Future<CreateClusterResponse> createCluster({
  1. required String clusterName,
  2. ClusterAutoScalingConfig? autoScaling,
  3. String? clusterRole,
  4. List<ClusterInstanceGroupSpecification>? instanceGroups,
  5. ClusterNodeProvisioningMode? nodeProvisioningMode,
  6. ClusterNodeRecovery? nodeRecovery,
  7. ClusterOrchestrator? orchestrator,
  8. List<ClusterRestrictedInstanceGroupSpecification>? restrictedInstanceGroups,
  9. ClusterRestrictedInstanceGroupsConfig? restrictedInstanceGroupsConfig,
  10. List<Tag>? tags,
  11. ClusterTieredStorageConfig? tieredStorageConfig,
  12. VpcConfig? vpcConfig,
})

Creates an Amazon SageMaker HyperPod cluster. SageMaker HyperPod is a capability of SageMaker for creating and managing persistent clusters for developing large machine learning models, such as large language models (LLMs) and diffusion models. To learn more, see Amazon SageMaker HyperPod in the Amazon SageMaker Developer Guide.

May throw ResourceInUse. May throw ResourceLimitExceeded.

Parameter clusterName : The name for the new SageMaker HyperPod cluster.

Parameter autoScaling : The autoscaling configuration for the cluster. Enables automatic scaling of cluster nodes based on workload demand using a Karpenter-based system.

Parameter clusterRole : The Amazon Resource Name (ARN) of the IAM role that HyperPod assumes to perform cluster autoscaling operations. This role must have permissions for sagemaker:BatchAddClusterNodes and sagemaker:BatchDeleteClusterNodes. This is only required when autoscaling is enabled and when HyperPod is performing autoscaling operations.

Parameter instanceGroups : The instance groups to be created in the SageMaker HyperPod cluster.

Parameter nodeProvisioningMode : The mode for provisioning nodes in the cluster. You can specify the following modes:

  • Continuous: Scaling behavior that enables 1) concurrent operation execution within instance groups, 2) continuous retry mechanisms for failed operations, 3) enhanced customer visibility into cluster events through detailed event streams, 4) partial provisioning capabilities. Your clusters and instance groups remain InService while scaling. This mode is only supported for EKS orchestrated clusters.

Parameter nodeRecovery : The node recovery mode for the SageMaker HyperPod cluster. When set to Automatic, SageMaker HyperPod will automatically reboot or replace faulty nodes when issues are detected. When set to None, cluster administrators will need to manually manage any faulty cluster instances.

Parameter orchestrator : The type of orchestrator to use for the SageMaker HyperPod cluster. Currently, supported values are "Eks" and "Slurm", which is to use an Amazon Elastic Kubernetes Service or Slurm cluster as the orchestrator.

Parameter restrictedInstanceGroups : The specialized instance groups for training models like Amazon Nova to be created in the SageMaker HyperPod cluster.

Parameter restrictedInstanceGroupsConfig : The configuration for the restricted instance groups (RIG) in the SageMaker HyperPod cluster.

Parameter tags : Custom tags for managing the SageMaker HyperPod cluster as an Amazon Web Services resource. You can add tags to your cluster in the same way you add them in other Amazon Web Services services that support tagging. To learn more about tagging Amazon Web Services resources in general, see Tagging Amazon Web Services Resources User Guide.

Parameter tieredStorageConfig : The configuration for managed tier checkpointing on the HyperPod cluster. When enabled, this feature uses a multi-tier storage approach for storing model checkpoints, providing faster checkpoint operations and improved fault tolerance across cluster nodes.

Parameter vpcConfig : Specifies the Amazon Virtual Private Cloud (VPC) that is associated with the Amazon SageMaker HyperPod cluster. You can control access to and from your resources by configuring your VPC. For more information, see Give SageMaker access to resources in your Amazon VPC.

  • Slurm-orchestrated clusters automatically configure nodes with dual IPv6 and IPv4 addresses, allowing immediate IPv6 network communications.
  • In Amazon EKS-orchestrated clusters, nodes receive dual-stack addressing, but pods can only use IPv6 when the Amazon EKS cluster is explicitly IPv6-enabled. For information about deploying an IPv6 Amazon EKS cluster, see Amazon EKS IPv6 Cluster Deployment.
Additional resources for IPv6 configuration:

Implementation

Future<CreateClusterResponse> createCluster({
  required String clusterName,
  ClusterAutoScalingConfig? autoScaling,
  String? clusterRole,
  List<ClusterInstanceGroupSpecification>? instanceGroups,
  ClusterNodeProvisioningMode? nodeProvisioningMode,
  ClusterNodeRecovery? nodeRecovery,
  ClusterOrchestrator? orchestrator,
  List<ClusterRestrictedInstanceGroupSpecification>? restrictedInstanceGroups,
  ClusterRestrictedInstanceGroupsConfig? restrictedInstanceGroupsConfig,
  List<Tag>? tags,
  ClusterTieredStorageConfig? tieredStorageConfig,
  VpcConfig? vpcConfig,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      if (autoScaling != null) 'AutoScaling': autoScaling,
      if (clusterRole != null) 'ClusterRole': clusterRole,
      if (instanceGroups != null) 'InstanceGroups': instanceGroups,
      if (nodeProvisioningMode != null)
        'NodeProvisioningMode': nodeProvisioningMode.value,
      if (nodeRecovery != null) 'NodeRecovery': nodeRecovery.value,
      if (orchestrator != null) 'Orchestrator': orchestrator,
      if (restrictedInstanceGroups != null)
        'RestrictedInstanceGroups': restrictedInstanceGroups,
      if (restrictedInstanceGroupsConfig != null)
        'RestrictedInstanceGroupsConfig': restrictedInstanceGroupsConfig,
      if (tags != null) 'Tags': tags,
      if (tieredStorageConfig != null)
        'TieredStorageConfig': tieredStorageConfig,
      if (vpcConfig != null) 'VpcConfig': vpcConfig,
    },
  );

  return CreateClusterResponse.fromJson(jsonResponse.body);
}