Skip to content
GitHubXDiscordRSS

Cluster

Learn how to create, update, and manage AWS SageMaker Clusters using Alchemy Cloud Control.

The Cluster resource allows you to manage AWS SageMaker Clusters for machine learning tasks, enabling you to specify instance types, configurations, and networking options.

Create a basic SageMaker Cluster with essential properties.

import AWS from "alchemy/aws/control";
const basicCluster = await AWS.SageMaker.Cluster("basicCluster", {
InstanceGroups: [
{
InstanceType: "ml.m5.large",
InstanceCount: 2
}
],
ClusterName: "MyFirstSageMakerCluster",
VpcConfig: {
SecurityGroupIds: ["sg-0123456789abcdef0"],
Subnets: ["subnet-0123456789abcdef0"]
}
});

Configure a SageMaker Cluster with node recovery and specific orchestrator settings.

const advancedCluster = await AWS.SageMaker.Cluster("advancedCluster", {
InstanceGroups: [
{
InstanceType: "ml.m5.xlarge",
InstanceCount: 3
}
],
ClusterName: "AdvancedSageMakerCluster",
NodeRecovery: "ENABLED",
Orchestrator: {
Type: "AWS::SageMaker::Orchestrator",
Properties: {
Workflow: "arn:aws:sagemaker:us-west-2:123456789012:workflow/MyWorkflow"
}
},
Tags: [
{ Key: "Environment", Value: "Production" },
{ Key: "Team", Value: "DataScience" }
]
});

Create a cluster with tags for better resource management and cost tracking.

const taggedCluster = await AWS.SageMaker.Cluster("taggedCluster", {
InstanceGroups: [
{
InstanceType: "ml.t2.medium",
InstanceCount: 1
}
],
ClusterName: "TaggedSageMakerCluster",
Tags: [
{ Key: "Project", Value: "MachineLearning" },
{ Key: "Owner", Value: "DataTeam" }
]
});

Set up a cluster with a custom VPC configuration for enhanced security.

const vpcCluster = await AWS.SageMaker.Cluster("vpcCluster", {
InstanceGroups: [
{
InstanceType: "ml.c5.2xlarge",
InstanceCount: 2
}
],
ClusterName: "VPCCustomSageMakerCluster",
VpcConfig: {
SecurityGroupIds: ["sg-0987654321abcdef0"],
Subnets: ["subnet-0987654321abcdef0", "subnet-1234567890abcdef0"]
}
});