Skip to content

create_cluster async

create_cluster(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    cluster_name: Optional[ClusterName] = None,
    instance_groups: Optional[ClusterInstanceGroupSpecifications] = None,
    restricted_instance_groups: Optional[
        ClusterRestrictedInstanceGroupSpecifications
    ] = None,
    restricted_instance_groups_config: Optional[
        ClusterRestrictedInstanceGroupsConfig
    ] = None,
    vpc_config: Optional[VpcConfig] = None,
    tags: Optional[TagList] = None,
    orchestrator: Optional[ClusterOrchestrator] = None,
    node_recovery: Optional[ClusterNodeRecovery] = None,
    tiered_storage_config: Optional[ClusterTieredStorageConfig] = None,
    node_provisioning_mode: Optional[ClusterNodeProvisioningMode] = None,
    cluster_role: Optional[RoleArn] = None,
    auto_scaling: Optional[ClusterAutoScalingConfig] = None,
) -> CreateClusterResponse

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.

Parameters:

  • cluster_name (Optional[ClusterName], default: None ) –

    The name for the new SageMaker HyperPod cluster.

  • instance_groups (Optional[ClusterInstanceGroupSpecifications], default: None ) –

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

  • restricted_instance_groups (Optional[ClusterRestrictedInstanceGroupSpecifications], default: None ) –

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

  • restricted_instance_groups_config (Optional[ClusterRestrictedInstanceGroupsConfig], default: None ) –

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

  • vpc_config (Optional[VpcConfig], default: None ) –

    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.

    When your Amazon VPC and subnets support IPv6, network communications differ based on the cluster orchestration platform:

    • 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:

  • tags (Optional[TagList], default: None ) –

    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.

  • orchestrator (Optional[ClusterOrchestrator], default: None ) –

    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.

    If you specify the Orchestrator field, you must provide exactly one orchestrator configuration: either Eks or Slurm. Specifying both or providing an empty configuration returns a validation error.

  • node_recovery (Optional[ClusterNodeRecovery], default: None ) –

    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.

  • tiered_storage_config (Optional[ClusterTieredStorageConfig], default: None ) –

    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.

  • node_provisioning_mode (Optional[ClusterNodeProvisioningMode], default: None ) –

    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.

  • cluster_role (Optional[RoleArn], default: None ) –

    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.

  • auto_scaling (Optional[ClusterAutoScalingConfig], default: None ) –

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

Raises:

  • ResourceInUse –

    Resource being accessed is in use.

  • ResourceLimitExceeded –

    You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_cluster(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    cluster_name: Optional["capo_sagemaker.types.cluster_name.ClusterName"] = None,
    instance_groups: Optional[
        "capo_sagemaker.types.cluster_instance_group_specifications.ClusterInstanceGroupSpecifications"
    ] = None,
    restricted_instance_groups: Optional[
        "capo_sagemaker.types.cluster_restricted_instance_group_specifications.ClusterRestrictedInstanceGroupSpecifications"
    ] = None,
    restricted_instance_groups_config: Optional[
        "capo_sagemaker.types.cluster_restricted_instance_groups_config.ClusterRestrictedInstanceGroupsConfig"
    ] = None,
    vpc_config: Optional["capo_sagemaker.types.vpc_config.VpcConfig"] = None,
    tags: Optional["capo_sagemaker.types.tag_list.TagList"] = None,
    orchestrator: Optional[
        "capo_sagemaker.types.cluster_orchestrator.ClusterOrchestrator"
    ] = None,
    node_recovery: Optional[
        "capo_sagemaker.types.cluster_node_recovery.ClusterNodeRecovery"
    ] = None,
    tiered_storage_config: Optional[
        "capo_sagemaker.types.cluster_tiered_storage_config.ClusterTieredStorageConfig"
    ] = None,
    node_provisioning_mode: Optional[
        "capo_sagemaker.types.cluster_node_provisioning_mode.ClusterNodeProvisioningMode"
    ] = None,
    cluster_role: Optional["capo_sagemaker.types.role_arn.RoleArn"] = None,
    auto_scaling: Optional[
        "capo_sagemaker.types.cluster_auto_scaling_config.ClusterAutoScalingConfig"
    ] = None,
) -> "capo_sagemaker.types.create_cluster_response.CreateClusterResponse":
    """<p>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 <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod.html">Amazon SageMaker HyperPod</a> in the <i>Amazon SageMaker Developer Guide</i>.</p>

    Args:
        cluster_name: <p>The name for the new SageMaker HyperPod cluster.</p>
        instance_groups: <p>The instance groups to be created in the SageMaker HyperPod cluster.</p>
        restricted_instance_groups: <p>The specialized instance groups for training models like Amazon Nova to be created in the SageMaker HyperPod cluster.</p>
        restricted_instance_groups_config: <p>The configuration for the restricted instance groups (RIG) in the SageMaker HyperPod cluster.</p>
        vpc_config: <p>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 <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/infrastructure-give-access.html">Give SageMaker access to resources in your Amazon VPC</a>.</p> <note> <p>When your Amazon VPC and subnets support IPv6, network communications differ based on the cluster orchestration platform:</p> <ul> <li> <p>Slurm-orchestrated clusters automatically configure nodes with dual IPv6 and IPv4 addresses, allowing immediate IPv6 network communications.</p> </li> <li> <p>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 <a href="https://docs.aws.amazon.com/eks/latest/userguide/deploy-ipv6-cluster.html#_deploy_an_ipv6_cluster_with_eksctl">Amazon EKS IPv6 Cluster Deployment</a>.</p> </li> </ul> <p>Additional resources for IPv6 configuration:</p> <ul> <li> <p>For information about adding IPv6 support to your VPC, see to <a href="https://docs.aws.amazon.com/vpc/latest/userguide/vpc-migrate-ipv6.html">IPv6 Support for VPC</a>.</p> </li> <li> <p>For information about creating a new IPv6-compatible VPC, see <a href="https://docs.aws.amazon.com/vpc/latest/userguide/create-vpc.html">Amazon VPC Creation Guide</a>.</p> </li> <li> <p>To configure SageMaker HyperPod with a custom Amazon VPC, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-hyperpod-prerequisites.html#sagemaker-hyperpod-prerequisites-optional-vpc">Custom Amazon VPC Setup for SageMaker HyperPod</a>.</p> </li> </ul> </note>
        tags: <p>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 <a href="https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html">Tagging Amazon Web Services Resources User Guide</a>.</p>
        orchestrator: <p>The type of orchestrator to use for the SageMaker HyperPod cluster. Currently, supported values are <code>"Eks"</code> and <code>"Slurm"</code>, which is to use an Amazon Elastic Kubernetes Service or Slurm cluster as the orchestrator.</p> <note> <p>If you specify the <code>Orchestrator</code> field, you must provide exactly one orchestrator configuration: either <code>Eks</code> or <code>Slurm</code>. Specifying both or providing an empty configuration returns a validation error.</p> </note>
        node_recovery: <p>The node recovery mode for the SageMaker HyperPod cluster. When set to <code>Automatic</code>, SageMaker HyperPod will automatically reboot or replace faulty nodes when issues are detected. When set to <code>None</code>, cluster administrators will need to manually manage any faulty cluster instances.</p>
        tiered_storage_config: <p>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.</p>
        node_provisioning_mode: <p>The mode for provisioning nodes in the cluster. You can specify the following modes:</p> <ul> <li> <p> <b>Continuous</b>: 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 <code>InService</code> while scaling. This mode is only supported for EKS orchestrated clusters.</p> </li> </ul>
        cluster_role: <p>The Amazon Resource Name (ARN) of the IAM role that HyperPod assumes to perform cluster autoscaling operations. This role must have permissions for <code>sagemaker:BatchAddClusterNodes</code> and <code>sagemaker:BatchDeleteClusterNodes</code>. This is only required when autoscaling is enabled and when HyperPod is performing autoscaling operations.</p>
        auto_scaling: <p>The autoscaling configuration for the cluster. Enables automatic scaling of cluster nodes based on workload demand using a Karpenter-based system.</p>

    Raises:
        capo_sagemaker.errors.resource_in_use.ResourceInUse: <p>Resource being accessed is in use.</p>
        capo_sagemaker.errors.resource_limit_exceeded.ResourceLimitExceeded: <p> You have exceeded an SageMaker resource limit. For example, you might have too many training jobs created. </p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_cluster_request.CreateClusterRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_cluster_response.CreateClusterResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_cluster

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_cluster.async_create_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateCluster")
    )
    input_: capo_sagemaker.types.create_cluster_request.CreateClusterRequest = {}
    if cluster_name is not None:
        input_["cluster_name"] = cluster_name
    if instance_groups is not None:
        input_["instance_groups"] = instance_groups
    if restricted_instance_groups is not None:
        input_["restricted_instance_groups"] = restricted_instance_groups
    if restricted_instance_groups_config is not None:
        input_["restricted_instance_groups_config"] = (
            restricted_instance_groups_config
        )
    if vpc_config is not None:
        input_["vpc_config"] = vpc_config
    if tags is not None:
        input_["tags"] = tags
    if orchestrator is not None:
        input_["orchestrator"] = orchestrator
    if node_recovery is not None:
        input_["node_recovery"] = node_recovery
    if tiered_storage_config is not None:
        input_["tiered_storage_config"] = tiered_storage_config
    if node_provisioning_mode is not None:
        input_["node_provisioning_mode"] = node_provisioning_mode
    if cluster_role is not None:
        input_["cluster_role"] = cluster_role
    if auto_scaling is not None:
        input_["auto_scaling"] = auto_scaling

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output