ALIYUN::PaiDswApi::Instance

更新时间:
复制 MD 格式

Creates a PAI-DSW (Data Science Workshop) instance.

Syntax

{
  "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
  }
}

Properties

Property Name

Type

Required

Update allowed

Description

Constraints

Datasets

List

No

Yes

Datasets to mount on the instance.

None

InstanceName

String

Yes

Yes

The name of the instance.

Format:

  • Can contain only letters, digits, and underscores (_).

  • Maximum 27 characters.

EnvironmentVariables

Map

No

No

The environment variables.

None

Accessibility

String

No

Yes

Whether the instance is visible to other workspace users.

Valid values:

  • PRIVATE: The instance is visible only to yourself and administrators in the workspace.

  • PUBLIC: The instance is visible to all users in the workspace.

WorkspaceId

String

No

No

The ID of the workspace.

Obtain the workspace ID from List workspaces.

ImageUrl

String

Yes

Yes

The container image URL.

Obtain the image URL from List images.

EcsSpec

String

Yes

Yes

The ECS instance type.

Obtain available types from List ECS instance types.

Labels

List

No

No

The custom tags.

None

SaveImage

Boolean

No

No

Whether to shut down the instance after saving the environment.

Valid values:

  • true: Shuts down the instance after saving the environment.

  • false: Keeps the instance running after saving the environment.

UserVpc

Map

No

No

The VPC configuration.

None

Datasets syntax

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

Datasets properties

Property Name

Type

Required

Update allowed

Description

Constraints

MountPath

String

No

Yes

The mount path in the container.

None

DatasetId

String

No

Yes

The ID of the dataset.

Obtain the dataset ID from List datasets.

Labels syntax

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

Labels properties

Property Name

Type

Required

Update allowed

Description

Constraints

Value

String

No

No

The tag value.

0–128 characters. Cannot start with aliyun or acs:. Cannot contain http:// or https://.

Key

String

No

No

The tag key.

1–128 characters. Cannot start with aliyun or acs:. Cannot contain http:// or https://.

UserVpc syntax

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

UserVpc properties

Property Name

Type

Required

Update allowed

Description

Constraints

VpcId

String

No

Yes

The VPC ID.

None

SecurityGroupId

String

No

Yes

The security group ID.

None

Return values

Fn::GetAtt

  • Datasets: The mounted datasets.

  • InstanceName: The name of the instance.

  • EnvironmentVariables: The environment variables.

  • Accessibility: Instance visibility to other workspace users.

  • InstanceId: The ID of the instance.

  • WorkspaceId: The ID of the workspace.

  • ImageUrl: The container image URL.

  • PaymentType: The billing method.

  • EcsSpec: The ECS instance type.

  • Labels: The custom tags.

  • UserVpc: The VPC configuration.

  • JupyterlabUrl: The JupyterLab URL.

  • TerminalUrl: The terminal URL.

  • InstanceUrl: The instance URL.

  • WebIDEUrl: The Web IDE URL.

Examples

YAML format

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 format

{
  "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"
        ]
      }
    }
  }
}