全部產品
Search
文件中心

:ALIYUN::PaiDswApi::Instance

更新時間:Feb 05, 2024

ALIYUN::PaiDswApi::Instance類型用於建立一個DSW執行個體。

文法

{
  "Type": "ALIYUN::PaiDswApi::Instance",
  "Properties": {
    "Datasets": List,
    "InstanceName": String,
    "EnvironmentVariables": Map,
    "Accessibility": String,
    "WorkspaceId": String,
    "ImageUrl": String,
    "EcsSpec": String,
    "Labels": List,
    "SaveImage": Boolean,
    "UserVpc": Map
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

Datasets

List

資料集集合。

InstanceName

String

執行個體名稱。

格式要求:

  • 只能包含英文字母、數字和底線(_)。

  • 不能超過27個字元。

EnvironmentVariables

Map

環境變數。

Accessibility

String

工作空間內是否他人可見。

取值:

  • PRIVATE:表示工作空間內自己及管理員可見。

  • PUBLIC:工作空間所有使用者可見。

WorkspaceId

String

工作空間ID。

ImageUrl

String

鏡像地址。

EcsSpec

String

執行個體對應的ECS規格。

Labels

List

使用者自訂標籤。

SaveImage

Boolean

儲存環境後是否關閉執行個體。

取值:

  • true:儲存環境後關閉執行個體。

  • false:儲存環境後不關閉執行個體。

UserVpc

Map

User VPC配置。

Datasets文法

"Datasets": [
  {
    "MountPath": String,
    "DatasetId": String
  }
]

Datasets屬性

屬性名稱

類型

必須

允許更新

描述

約束

MountPath

String

容器內掛載路徑。

DatasetId

String

資料集ID。

Labels文法

"Labels": [
  {
    "Value": String,
    "Key": String
  }
]

Labels屬性

屬性名稱

類型

必須

允許更新

描述

約束

Value

String

使用者定義標籤值。

長度為0~128個字元,不能以aliyunacs:開頭,不能包含http://https://

Key

String

使用者定義標籤鍵。

長度為1~128個字元,不能以aliyunacs:開頭,不能包含http://https://

UserVpc文法

"UserVpc": {
  "VpcId": String,
  "SecurityGroupId": String
}

UserVpc屬性

屬性名稱

類型

必須

允許更新

描述

約束

VpcId

String

VPC ID。

SecurityGroupId

String

安全性群組ID。

傳回值

Fn::GetAtt

  • Datasets:資料集集合。

  • InstanceName:執行個體名稱。

  • EnvironmentVariables:環境變數。

  • Accessibility:工作空間內是否他人可見。

  • InstanceId:執行個體ID。

  • WorkspaceId:工作空間ID。

  • ImageUrl:鏡像地址。

  • PaymentType:資源的支付類型。

  • EcsSpec:執行個體對應的ECS規格。

  • Labels:使用者自訂標籤。

  • UserVpc:User VPC配置。

  • JupyterlabUrl:Jupyterlab Url。

  • TerminalUrl:終端Url。

  • InstanceUrl:執行個體Url。

  • WebIDEUrl:Web IDE Url。

樣本

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  EcsSpec:
    Description: The ECS specification of the instance.
    Type: String
    Default: ecs.gn5-c28g1.7xlarge
  ImageUrl:
    Description: The mirror address.
    Type: String
    Default: registry-vpc.cn-shanghai.aliyuncs.com/******/pai:python_3.8.10-tensorflow_2.9.0
  InstanceName:
    AllowedPattern: ^[_a-zA-Z0-9]{1,27}$
    Description: 'The instance name. Format requirements:

      - Can only contain letters, numbers and underscores (_).

      - It cannot exceed 27 characters.'
    Type: String
Resources:
  ExtensionResource:
    Properties:
      EcsSpec:
        Ref: EcsSpec
      ImageUrl:
        Ref: ImageUrl
      InstanceName:
        Ref: InstanceName
    Type: ALIYUN::PaiDswApi::Instance
Outputs:
  Accessibility:
    Description: Whether the workspace is visible to others.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - Accessibility
  Datasets:
    Description: A collection of datasets.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - Datasets
  EcsSpec:
    Description: The ECS specification of the instance.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - EcsSpec
  EnvironmentVariables:
    Description: Environment variable.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - EnvironmentVariables
  ImageUrl:
    Description: The mirror address.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - ImageUrl
  InstanceId:
    Description: The first ID of the resource.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - InstanceId
  InstanceName:
    Description: The instance name.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - InstanceName
  Labels:
    Description: User-defined labels.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - Labels
  PaymentType:
    Description: The payment type of the resource.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - PaymentType
  UserVpc:
    Description: User vpc configuration.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - UserVpc
  WorkspaceId:
    Description: The Id of the workspace.
    Value:
      Fn::GetAtt:
      - ExtensionResource
      - WorkspaceId

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "EcsSpec": {
      "Description": "The ECS specification of the instance.",
      "Type": "String",
      "Default": "ecs.gn5-c28g1.7xlarge"
    },
    "ImageUrl": {
      "Description": "The mirror address.",
      "Type": "String",
      "Default": "registry-vpc.cn-shanghai.aliyuncs.com/******/pai:python_3.8.10-tensorflow_2.9.0"
    },
    "InstanceName": {
      "AllowedPattern": "^[_a-zA-Z0-9]{1,27}$",
      "Description": "The instance name. Format requirements:\n- Can only contain letters, numbers and underscores (_).\n- It cannot exceed 27 characters.",
      "Type": "String"
    }
  },
  "Resources": {
    "ExtensionResource": {
      "Properties": {
        "EcsSpec": {
          "Ref": "EcsSpec"
        },
        "ImageUrl": {
          "Ref": "ImageUrl"
        },
        "InstanceName": {
          "Ref": "InstanceName"
        }
      },
      "Type": "ALIYUN::PaiDswApi::Instance"
    }
  },
  "Outputs": {
    "Accessibility": {
      "Description": "Whether the workspace is visible to others.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Accessibility"
        ]
      }
    },
    "Datasets": {
      "Description": "A collection of datasets.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Datasets"
        ]
      }
    },
    "EcsSpec": {
      "Description": "The ECS specification of the instance.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "EcsSpec"
        ]
      }
    },
    "EnvironmentVariables": {
      "Description": "Environment variable.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "EnvironmentVariables"
        ]
      }
    },
    "ImageUrl": {
      "Description": "The mirror address.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "ImageUrl"
        ]
      }
    },
    "InstanceId": {
      "Description": "The first ID of the resource.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "InstanceId"
        ]
      }
    },
    "InstanceName": {
      "Description": "The instance name.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "InstanceName"
        ]
      }
    },
    "Labels": {
      "Description": "User-defined labels.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "Labels"
        ]
      }
    },
    "PaymentType": {
      "Description": "The payment type of the resource.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "PaymentType"
        ]
      }
    },
    "UserVpc": {
      "Description": "User vpc configuration.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "UserVpc"
        ]
      }
    },
    "WorkspaceId": {
      "Description": "The Id of the workspace.",
      "Value": {
        "Fn::GetAtt": [
          "ExtensionResource",
          "WorkspaceId"
        ]
      }
    }
  }
}