{
 "additionalIdentifiers": [
  [
   "/properties/ClusterName"
  ]
 ],
 "additionalProperties": false,
 "createOnlyProperties": [
  "/properties/ClusterName",
  "/properties/VpcConfig",
  "/properties/Orchestrator/Eks"
 ],
 "definitions": {
  "AlarmDetails": {
   "additionalProperties": false,
   "properties": {
    "AlarmName": {
     "maxLength": 256,
     "minLength": 1,
     "pattern": "(?!\\s*$).+",
     "type": "string"
    }
   },
   "required": [
    "AlarmName"
   ],
   "type": "object"
  },
  "AutoRollbackConfiguration": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/AlarmDetails"
   },
   "maxItems": 10,
   "minItems": 1,
   "type": "array"
  },
  "CapacitySizeConfig": {
   "additionalProperties": false,
   "properties": {
    "Type": {
     "pattern": "INSTANCE_COUNT|CAPACITY_PERCENTAGE",
     "type": "string"
    },
    "Value": {
     "minimum": 1,
     "type": "integer"
    }
   },
   "required": [
    "Type",
    "Value"
   ],
   "type": "object"
  },
  "ClusterAutoScalingConfig": {
   "additionalProperties": false,
   "properties": {
    "AutoScalerType": {
     "default": "Karpenter",
     "enum": [
      "Karpenter"
     ],
     "type": "string"
    },
    "Mode": {
     "enum": [
      "Enable",
      "Disable"
     ],
     "type": "string"
    }
   },
   "required": [
    "Mode"
   ],
   "type": "object"
  },
  "ClusterCapacityRequirements": {
   "additionalProperties": false,
   "properties": {
    "OnDemand": {
     "$ref": "#/definitions/ClusterOnDemandOptions"
    },
    "Spot": {
     "$ref": "#/definitions/ClusterSpotOptions"
    }
   },
   "type": "object"
  },
  "ClusterEbsVolumeConfig": {
   "additionalProperties": false,
   "properties": {
    "RootVolume": {
     "type": "boolean"
    },
    "VolumeKmsKeyId": {
     "maxLength": 2048,
     "minLength": 0,
     "pattern": "^[a-zA-Z0-9:/_-]*$",
     "type": "string"
    },
    "VolumeSizeInGB": {
     "maximum": 16384,
     "minimum": 1,
     "type": "integer"
    }
   },
   "type": "object"
  },
  "ClusterFsxLustreConfig": {
   "additionalProperties": false,
   "properties": {
    "DnsName": {
     "maxLength": 275,
     "minLength": 16,
     "pattern": "^((fs|fc)i?-[0-9a-f]{8,}\\..{4,253})$",
     "type": "string"
    },
    "MountName": {
     "maxLength": 8,
     "minLength": 1,
     "pattern": "^([A-Za-z0-9_-]{1,8})$",
     "type": "string"
    },
    "MountPath": {
     "maxLength": 1024,
     "minLength": 1,
     "pattern": "^/(?!/)(?!.*/$)[a-zA-Z0-9._-]+(/[a-zA-Z0-9._-]+)*$",
     "type": "string"
    }
   },
   "required": [
    "DnsName",
    "MountName"
   ],
   "type": "object"
  },
  "ClusterFsxOpenZfsConfig": {
   "additionalProperties": false,
   "properties": {
    "DnsName": {
     "maxLength": 275,
     "minLength": 16,
     "pattern": "^((fs|fc)i?-[0-9a-f]{8,}\\..{4,253})$",
     "type": "string"
    },
    "MountPath": {
     "maxLength": 1024,
     "minLength": 1,
     "pattern": "^/(?!/)(?!.*/$)[a-zA-Z0-9._-]+(/[a-zA-Z0-9._-]+)*$",
     "type": "string"
    }
   },
   "required": [
    "DnsName"
   ],
   "type": "object"
  },
  "ClusterInstanceGroup": {
   "additionalProperties": false,
   "properties": {
    "CapacityRequirements": {
     "$ref": "#/definitions/ClusterCapacityRequirements"
    },
    "CurrentCount": {
     "minimum": 0,
     "type": "integer"
    },
    "ExecutionRole": {
     "$ref": "#/definitions/ExecutionRole"
    },
    "ImageId": {
     "$ref": "#/definitions/ImageId"
    },
    "InstanceCount": {
     "maximum": 6758,
     "minimum": 0,
     "type": "integer"
    },
    "InstanceGroupName": {
     "$ref": "#/definitions/InstanceGroupName"
    },
    "InstanceRequirements": {
     "$ref": "#/definitions/InstanceRequirements"
    },
    "InstanceStorageConfigs": {
     "$ref": "#/definitions/ClusterInstanceStorageConfigs"
    },
    "InstanceType": {
     "$ref": "#/definitions/InstanceType"
    },
    "KubernetesConfig": {
     "$ref": "#/definitions/ClusterKubernetesConfig"
    },
    "LifeCycleConfig": {
     "$ref": "#/definitions/ClusterLifeCycleConfig"
    },
    "MinInstanceCount": {
     "maximum": 6758,
     "minimum": 0,
     "type": "integer"
    },
    "NetworkInterface": {
     "$ref": "#/definitions/ClusterNetworkInterface"
    },
    "OnStartDeepHealthChecks": {
     "$ref": "#/definitions/OnStartDeepHealthChecks"
    },
    "OverrideVpcConfig": {
     "$ref": "#/definitions/VpcConfig"
    },
    "ScheduledUpdateConfig": {
     "$ref": "#/definitions/ScheduledUpdateConfig"
    },
    "SlurmConfig": {
     "$ref": "#/definitions/ClusterSlurmConfig"
    },
    "ThreadsPerCore": {
     "maximum": 2,
     "minimum": 1,
     "type": "integer"
    },
    "TrainingPlanArn": {
     "maxLength": 2048,
     "minLength": 50,
     "pattern": "^arn:aws[a-z\\-]*:sagemaker:[a-z0-9\\-]*:[0-9]{12}:training-plan/.*$",
     "type": "string"
    }
   },
   "required": [
    "ExecutionRole",
    "InstanceCount",
    "InstanceGroupName"
   ],
   "type": "object"
  },
  "ClusterInstanceGroupsList": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/ClusterInstanceGroup"
   },
   "maxItems": 100,
   "minItems": 1,
   "type": "array"
  },
  "ClusterInstanceStorageConfig": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "EbsVolumeConfig": {
       "$ref": "#/definitions/ClusterEbsVolumeConfig"
      }
     },
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "FsxLustreConfig": {
       "$ref": "#/definitions/ClusterFsxLustreConfig"
      }
     },
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "FsxOpenZfsConfig": {
       "$ref": "#/definitions/ClusterFsxOpenZfsConfig"
      }
     },
     "type": "object"
    }
   ],
   "type": "object"
  },
  "ClusterInstanceStorageConfigs": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/ClusterInstanceStorageConfig"
   },
   "maxItems": 4,
   "minItems": 0,
   "type": "array"
  },
  "ClusterKubernetesConfig": {
   "additionalProperties": false,
   "properties": {
    "Labels": {
     "$ref": "#/definitions/ClusterKubernetesLabels"
    },
    "Taints": {
     "$ref": "#/definitions/ClusterKubernetesTaints"
    }
   },
   "type": "object"
  },
  "ClusterKubernetesLabels": {
   "additionalProperties": false,
   "patternProperties": {
    "^.+$": {
     "type": "string"
    }
   },
   "type": "object"
  },
  "ClusterKubernetesTaint": {
   "additionalProperties": false,
   "properties": {
    "Effect": {
     "enum": [
      "NoSchedule",
      "PreferNoSchedule",
      "NoExecute"
     ],
     "type": "string"
    },
    "Key": {
     "maxLength": 317,
     "minLength": 1,
     "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$",
     "type": "string"
    },
    "Value": {
     "maxLength": 63,
     "minLength": 1,
     "pattern": "^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$",
     "type": "string"
    }
   },
   "required": [
    "Key",
    "Effect"
   ],
   "type": "object"
  },
  "ClusterKubernetesTaints": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/ClusterKubernetesTaint"
   },
   "maxItems": 50,
   "minItems": 0,
   "type": "array"
  },
  "ClusterLifeCycleConfig": {
   "additionalProperties": false,
   "properties": {
    "OnCreate": {
     "maxLength": 128,
     "minLength": 1,
     "pattern": "^[\\S\\s]+$",
     "type": "string"
    },
    "OnInitComplete": {
     "maxLength": 128,
     "minLength": 1,
     "pattern": "^[\\S\\s]+$",
     "type": "string"
    },
    "SourceS3Uri": {
     "maxLength": 1024,
     "minLength": 0,
     "pattern": "^(https|s3)://([^/]+)/?(.*)$",
     "type": "string"
    }
   },
   "type": "object"
  },
  "ClusterNetworkInterface": {
   "additionalProperties": false,
   "properties": {
    "InterfaceType": {
     "enum": [
      "efa",
      "efa-only"
     ],
     "type": "string"
    }
   },
   "required": [
    "InterfaceType"
   ],
   "type": "object"
  },
  "ClusterOnDemandOptions": {
   "additionalProperties": false,
   "type": "object"
  },
  "ClusterOrchestratorEksConfig": {
   "additionalProperties": false,
   "properties": {
    "ClusterArn": {
     "type": "string"
    }
   },
   "required": [
    "ClusterArn"
   ],
   "type": "object"
  },
  "ClusterOrchestratorSlurmConfig": {
   "additionalProperties": false,
   "properties": {
    "SlurmConfigStrategy": {
     "enum": [
      "Overwrite",
      "Managed",
      "Merge"
     ],
     "type": "string"
    }
   },
   "type": "object"
  },
  "ClusterRestrictedInstanceGroup": {
   "additionalProperties": false,
   "properties": {
    "CurrentCount": {
     "minimum": 0,
     "type": "integer"
    },
    "EnvironmentConfig": {
     "$ref": "#/definitions/EnvironmentConfig"
    },
    "ExecutionRole": {
     "$ref": "#/definitions/ExecutionRole"
    },
    "InstanceCount": {
     "maximum": 6758,
     "minimum": 0,
     "type": "integer"
    },
    "InstanceGroupName": {
     "$ref": "#/definitions/InstanceGroupName"
    },
    "InstanceStorageConfigs": {
     "$ref": "#/definitions/ClusterInstanceStorageConfigs"
    },
    "InstanceType": {
     "$ref": "#/definitions/InstanceType"
    },
    "OnStartDeepHealthChecks": {
     "$ref": "#/definitions/OnStartDeepHealthChecks"
    },
    "OverrideVpcConfig": {
     "$ref": "#/definitions/VpcConfig"
    },
    "ThreadsPerCore": {
     "maximum": 2,
     "minimum": 1,
     "type": "integer"
    },
    "TrainingPlanArn": {
     "maxLength": 2048,
     "minLength": 50,
     "pattern": "^arn:aws[a-z\\-]*:sagemaker:[a-z0-9\\-]*:[0-9]{12}:training-plan/.*$",
     "type": "string"
    }
   },
   "required": [
    "ExecutionRole",
    "InstanceCount",
    "InstanceGroupName",
    "InstanceType",
    "EnvironmentConfig"
   ],
   "type": "object"
  },
  "ClusterRestrictedInstanceGroupsList": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/ClusterRestrictedInstanceGroup"
   },
   "maxItems": 100,
   "minItems": 1,
   "type": "array"
  },
  "ClusterSlurmConfig": {
   "additionalProperties": false,
   "properties": {
    "NodeType": {
     "enum": [
      "Controller",
      "Login",
      "Compute"
     ],
     "type": "string"
    },
    "PartitionNames": {
     "insertionOrder": false,
     "items": {
      "maxLength": 1024,
      "minLength": 0,
      "pattern": "^[a-zA-Z0-9](-*[a-zA-Z0-9])*$",
      "type": "string"
     },
     "maxItems": 1,
     "minItems": 0,
     "type": "array"
    }
   },
   "required": [
    "NodeType"
   ],
   "type": "object"
  },
  "ClusterSpotOptions": {
   "additionalProperties": false,
   "type": "object"
  },
  "DeepHealthCheckType": {
   "enum": [
    "InstanceStress",
    "InstanceConnectivity"
   ],
   "type": "string"
  },
  "DeploymentConfig": {
   "additionalProperties": false,
   "properties": {
    "AutoRollbackConfiguration": {
     "$ref": "#/definitions/AutoRollbackConfiguration"
    },
    "RollingUpdatePolicy": {
     "$ref": "#/definitions/RollingUpdatePolicy"
    },
    "WaitIntervalInSeconds": {
     "maximum": 3600,
     "minimum": 0,
     "type": "integer"
    }
   },
   "type": "object"
  },
  "EnvironmentConfig": {
   "additionalProperties": false,
   "properties": {
    "FSxLustreConfig": {
     "$ref": "#/definitions/FSxLustreConfig"
    }
   },
   "type": "object"
  },
  "ExecutionRole": {
   "maxLength": 2048,
   "minLength": 20,
   "pattern": "^arn:aws[a-z\\-]*:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+$",
   "type": "string"
  },
  "FSxLustreConfig": {
   "additionalProperties": false,
   "properties": {
    "PerUnitStorageThroughput": {
     "maximum": 1000,
     "minimum": 125,
     "type": "integer"
    },
    "SizeInGiB": {
     "maximum": 100800,
     "minimum": 1200,
     "type": "integer"
    }
   },
   "required": [
    "SizeInGiB",
    "PerUnitStorageThroughput"
   ],
   "type": "object"
  },
  "ImageId": {
   "format": "AWS::EC2::Image.Id",
   "maxLength": 21,
   "minLength": 7,
   "pattern": "^ami-[0-9a-fA-F]{8,17}|default$",
   "type": "string"
  },
  "InstanceGroupName": {
   "maxLength": 63,
   "minLength": 1,
   "pattern": "^[a-zA-Z0-9](-*[a-zA-Z0-9])*$",
   "type": "string"
  },
  "InstanceRequirements": {
   "additionalProperties": false,
   "properties": {
    "InstanceTypes": {
     "insertionOrder": true,
     "items": {
      "$ref": "#/definitions/InstanceType"
     },
     "maxItems": 20,
     "minItems": 1,
     "type": "array"
    }
   },
   "required": [
    "InstanceTypes"
   ],
   "type": "object"
  },
  "InstanceType": {
   "type": "string"
  },
  "OnStartDeepHealthChecks": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/DeepHealthCheckType"
   },
   "maxItems": 2,
   "minItems": 1,
   "type": "array"
  },
  "Orchestrator": {
   "oneOf": [
    {
     "additionalProperties": false,
     "properties": {
      "Eks": {
       "$ref": "#/definitions/ClusterOrchestratorEksConfig"
      }
     },
     "type": "object"
    },
    {
     "additionalProperties": false,
     "properties": {
      "Slurm": {
       "$ref": "#/definitions/ClusterOrchestratorSlurmConfig"
      }
     },
     "type": "object"
    }
   ],
   "type": "object"
  },
  "RollingUpdatePolicy": {
   "additionalProperties": false,
   "properties": {
    "MaximumBatchSize": {
     "$ref": "#/definitions/CapacitySizeConfig"
    },
    "RollbackMaximumBatchSize": {
     "$ref": "#/definitions/CapacitySizeConfig"
    }
   },
   "required": [
    "MaximumBatchSize"
   ],
   "type": "object"
  },
  "ScheduledUpdateConfig": {
   "additionalProperties": false,
   "properties": {
    "DeploymentConfig": {
     "$ref": "#/definitions/DeploymentConfig"
    },
    "ScheduleExpression": {
     "maxLength": 256,
     "minLength": 1,
     "pattern": "cron\\((?:[0-5][0-9]|[0-9]|) (?:[01][0-9]|2[0-3]|[0-9]) (?:[1-9]|0[1-9]|[12][0-9]|3[01]|\\?) (?:[1-9]|0[1-9]|1[0-2]|\\*|\\*/(?:[1-9]|1[0-2])|) (?:MON|TUE|WED|THU|FRI|SAT|SUN|[1-7]|\\?|L|(?:[1-7]#[1-5])|(?:[1-7]L)) (?:20[2-9][0-9]|\\*|)\\)",
     "type": "string"
    }
   },
   "required": [
    "ScheduleExpression"
   ],
   "type": "object"
  },
  "Tag": {
   "additionalProperties": false,
   "properties": {
    "Key": {
     "maxLength": 128,
     "minLength": 1,
     "pattern": "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$",
     "type": "string"
    },
    "Value": {
     "maxLength": 256,
     "minLength": 0,
     "pattern": "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$",
     "type": "string"
    }
   },
   "required": [
    "Key",
    "Value"
   ],
   "type": "object"
  },
  "TieredStorageConfig": {
   "additionalProperties": false,
   "properties": {
    "InstanceMemoryAllocationPercentage": {
     "maximum": 100,
     "minimum": 0,
     "type": "integer"
    },
    "Mode": {
     "enum": [
      "Enable",
      "Disable"
     ],
     "type": "string"
    }
   },
   "required": [
    "Mode"
   ],
   "type": "object"
  },
  "VpcConfig": {
   "additionalProperties": false,
   "properties": {
    "SecurityGroupIds": {
     "format": "AWS::EC2::SecurityGroup.Ids",
     "insertionOrder": false,
     "items": {
      "format": "AWS::EC2::SecurityGroup.Id",
      "maxLength": 32,
      "minLength": 0,
      "pattern": "[-0-9a-zA-Z]+",
      "type": "string"
     },
     "maxItems": 5,
     "minItems": 1,
     "type": "array"
    },
    "Subnets": {
     "format": "AWS::EC2::Subnet.Ids",
     "insertionOrder": false,
     "items": {
      "format": "AWS::EC2::Subnet.Id",
      "maxLength": 32,
      "minLength": 0,
      "pattern": "[-0-9a-zA-Z]+",
      "type": "string"
     },
     "maxItems": 16,
     "minItems": 1,
     "type": "array"
    }
   },
   "required": [
    "SecurityGroupIds",
    "Subnets"
   ],
   "type": "object"
  }
 },
 "primaryIdentifier": [
  "/properties/ClusterArn"
 ],
 "properties": {
  "AutoScaling": {
   "$ref": "#/definitions/ClusterAutoScalingConfig"
  },
  "ClusterArn": {
   "maxLength": 256,
   "pattern": "^arn:aws[a-z\\-]*:sagemaker:[a-z0-9\\-]*:[0-9]{12}:cluster/[a-z0-9]{12}$",
   "type": "string"
  },
  "ClusterName": {
   "maxLength": 63,
   "minLength": 1,
   "pattern": "^[a-zA-Z0-9](-*[a-zA-Z0-9]){0,62}$",
   "type": "string"
  },
  "ClusterRole": {
   "maxLength": 2048,
   "minLength": 20,
   "pattern": "^arn:aws[a-z\\-]*:iam::\\d{12}:role/?[a-zA-Z_0-9+=,.@\\-_/]+$",
   "type": "string"
  },
  "ClusterStatus": {
   "enum": [
    "Creating",
    "Deleting",
    "Failed",
    "InService",
    "RollingBack",
    "SystemUpdating",
    "Updating"
   ],
   "type": "string"
  },
  "CreationTime": {
   "type": "string"
  },
  "FailureMessage": {
   "type": "string"
  },
  "InstanceGroups": {
   "$ref": "#/definitions/ClusterInstanceGroupsList"
  },
  "NodeProvisioningMode": {
   "enum": [
    "Continuous"
   ],
   "type": "string"
  },
  "NodeRecovery": {
   "enum": [
    "Automatic",
    "None"
   ],
   "type": "string"
  },
  "Orchestrator": {
   "$ref": "#/definitions/Orchestrator"
  },
  "RestrictedInstanceGroups": {
   "$ref": "#/definitions/ClusterRestrictedInstanceGroupsList"
  },
  "Tags": {
   "insertionOrder": false,
   "items": {
    "$ref": "#/definitions/Tag"
   },
   "maxItems": 50,
   "minItems": 0,
   "type": "array",
   "uniqueItems": true
  },
  "TieredStorageConfig": {
   "$ref": "#/definitions/TieredStorageConfig"
  },
  "VpcConfig": {
   "$ref": "#/definitions/VpcConfig"
  }
 },
 "readOnlyProperties": [
  "/properties/ClusterArn",
  "/properties/CreationTime",
  "/properties/ClusterStatus",
  "/properties/FailureMessage",
  "/properties/InstanceGroups/*/CurrentCount",
  "/properties/RestrictedInstanceGroups/*/CurrentCount"
 ],
 "required": [],
 "tagging": {
  "cloudFormationSystemTags": false,
  "tagOnCreate": true,
  "tagProperty": "/properties/Tags",
  "tagUpdatable": true,
  "taggable": true
 },
 "typeName": "AWS::SageMaker::Cluster"
}
