ALIYUN::NAS::FileSystem

ALIYUN::NAS::FileSystem类型用于创建文件系统。

语法

{
  "Type": "ALIYUN::NAS::FileSystem",
  "Properties": {
    "SnapshotId": String,
    "Description": String,
    "StorageType": String,
    "DeletionForce": Boolean,
    "EncryptType": Integer,
    "VpcId": String,
    "ZoneId": String,
    "Capacity": Integer,
    "Tags": List,
    "ProtocolType": String,
    "FileSystemType": String,
    "Bandwidth": Integer,
    "VSwitchId": String,
    "Duration": Integer,
    "ChargeType": String,
    "ResourceGroupId": String
  }
}  

属性

属性名称

类型

必须

允许更新

描述

约束

ProtocolType

String

协议类型。

取值:

  • NFS:NFS协议。

  • SMB:SMB协议。

  • cpfs:CPFS协议。

Bandwidth

Integer

文件系统吞吐上限。

FileSystemType取值为cpfs时该参数必须指定,取值根据Capacity确定。更多信息,请参见CPFS购买页面

单位:Mbps。

ChargeType

String

付费类型。

取值:

  • PayAsYouGo:按量付费。

  • Subscription:包年包月。

Duration

Integer

包年包月时长。

ChargeType取值为Subscription时该参数有效且必须指定。当包年包月实例到期时未进行续费,实例会自动到期释放。取值:

  • 1

  • 2

  • 3

  • 6

  • 12

  • 36

单位:月。

StorageType

String

存储类型。

取值:

  • FileSystemType取值为standard时:

    • Performance:性能型。

    • Capacity:容量型。

  • FileSystemType取值为extreme时:

    • standard:标准型。

    • advance:高级型。

  • FileSystemType取值为cpfs时:

    • advance_100:100 MB/s/TiB 基线。

    • advance_200:200 MB/s/TiB 基线。

DeletionForce

Boolean

是否强制删除。

取值:

  • true:强制删除。

  • false(默认值):不强制删除。

Description

String

文件系统描述。

长度为2~128个字符。必须以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、半角冒号(:)、下划线(_)和短划线(-)。

Tags

List

标签。

每个实例最多绑定20个标签。

更多信息,请参见Tags属性

SnapshotId

String

快照ID。

可以通过指定SnapshotId从指定快照创建NAS实例,目前仅支持极速型NAS。

说明

通过快照创建的文件系统版本需和快照源文件系统版本一致。如果不一致,可以执行以下步骤:

  1. 把快照源文件数据拷贝到创建的文件系统中。

  2. 拷贝完成后,把业务迁移到新的文件系统。

EncryptType

Integer

文件系统是否加密。使用KMS托管密钥,对文件系统落盘数据进行加密存储。在读写加密数据时,无需解密。

FileSystemType取值为standardextreme时该参数有效。取值:

  • 0:不加密。

  • 1:加密。

Capacity

Integer

文件系统容量。

FileSystemType取值为extremecpfs时该参数有效且必须指定。

取值范围:

  • FileSystemType取值为extreme时:100~262,144。

  • FileSystemType取值为cpfs时:2048~512,000。

单位:GB。

FileSystemType

String

文件系统类型。

取值:

  • standard(默认值):通用型。

  • extreme:极速型。

  • cpfs:并行文件系统。

VpcId

String

专有网络ID,指定VpcIdVSwitchId可以在创建文件系统实例的同时预配置一个默认挂载点。

FileSystemType取值为cpfs时,该参数必须指定。

VSwitchId

String

交换机ID,指定VpcIdVSwitchId可以在创建文件系统实例的同时预配置一个默认挂载点。

FileSystemType取值为cpfs时该参数必须指定。

ResourceGroupId

String

资源组ID。

ZoneId

String

可用区ID。

Tags语法

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

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

长度为1~128个字符,不能以aliyunacs:开头,不能包含http://https://

Value

String

标签值。

长度为0~128个字符,不能以aliyunacs:开头,不能包含http://https://

返回值

Fn::GetAtt

FileSystemId:文件系统ID。

示例

场景 1 :创建文件系统

ROSTemplateFormatVersion: '2015-09-01'
Description: Test NAS FileSystem
Parameters: {}
Resources:
  FileSystem:
    Type: ALIYUN::NAS::FileSystem
    Properties:
      ProtocolType: NFS
      StorageType: Capacity
Outputs:
  FileSystemId:
    Description: ID of the file system created
    Value:
      Fn::GetAtt:
        - FileSystem
        - FileSystemId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test NAS FileSystem",
  "Parameters": {
  },
  "Resources": {
    "FileSystem": {
      "Type": "ALIYUN::NAS::FileSystem",
      "Properties": {
        "ProtocolType": "NFS",
        "StorageType": "Capacity"
      }
    }
  },
  "Outputs": {
    "FileSystemId": {
      "Description": "ID of the file system created",
      "Value": {
        "Fn::GetAtt": [
          "FileSystem",
          "FileSystemId"
        ]
      }
    }
  }
}

场景 2 :创建NAS文件系统、访问组、访问规则及挂载点

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建NAS文件系统、访问组、访问规则及挂载目标,配置协议、存储类型、权限及网络设置。
  en: Create NAS file systems, access groups, access rules, and mount targets, configure
    protocols, storage types, permissions, and network settings.
Parameters:
  Description:
    Type: String
    Description: File system description.
    Default: mytest
  ProtocolType:
    Type: String
    Description: Type of protocol used.
    Default: NFS
    AllowedValues:
    - NFS
    - SMB
  StorageType:
    Type: String
    Description: The file system type.
    Default: Capacity
    AllowedValues:
    - Performance
    - Capacity
  AccessGroupName:
    Type: String
    Default: mytest
  VSwitchId:
    Type: String
  VpcId:
    Type: String
  Priority:
    Type: Number
    Description: 'Allowed Values: 1~100'
    Default: 1
    MinValue: 1
    MaxValue: 100
  UserAccessType:
    Type: String
    Default: no_squash
    AllowedValues:
    - no_squash
    - root_squash
    - all_squash
  SourceCidrIp:
    Type: String
    Description: Address or address segment
    Default: 0.0.0.0/0
  RWAccessType:
    Type: String
    Description: 'Read-write permission type: RDWR (default), RDONLY'
    Default: RDWR
    AllowedValues:
    - RDWR
    - RDONLY
Resources:
  FileSystem:
    Type: ALIYUN::NAS::FileSystem
    Properties:
      ProtocolType:
        Ref: ProtocolType
      StorageType:
        Ref: StorageType
      Description:
        Ref: Description
  AccessGroup:
    Type: ALIYUN::NAS::AccessGroup
    Properties:
      AccessGroupType: Vpc
      AccessGroupName:
        Ref: AccessGroupName
  AccessRule:
    Type: ALIYUN::NAS::AccessRule
    Properties:
      Priority:
        Ref: Priority
      UserAccessType:
        Ref: UserAccessType
      AccessGroupName:
        Fn::GetAtt:
        - AccessGroup
        - AccessGroupName
      SourceCidrIp:
        Ref: SourceCidrIp
      RWAccessType:
        Ref: RWAccessType
    DependsOn: AccessGroup
  MountTarget:
    Type: ALIYUN::NAS::MountTarget
    Properties:
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
      FileSystemId:
        Fn::GetAtt:
        - FileSystem
        - FileSystemId
      NetworkType: Vpc
      AccessGroupName:
        Fn::GetAtt:
        - AccessGroup
        - AccessGroupName
    DependsOn:
    - AccessRule
    - FileSystem
Outputs:
  FileSystemId:
    Description: ID of the file system created
    Value:
      Fn::GetAtt:
      - FileSystem
      - FileSystemId
  AccessGroupName:
    Description: Permission group name
    Value:
      Fn::GetAtt:
      - AccessGroup
      - AccessGroupName
  AccessRuleId:
    Value:
      Fn::GetAtt:
      - AccessRule
      - AccessRuleId
  MountTargetDomain:
    Value:
      Fn::GetAtt:
      - MountTarget
      - MountTargetDomain
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建NAS文件系统、访问组、访问规则及挂载目标,配置协议、存储类型、权限及网络设置。",
    "en": "Create NAS file systems, access groups, access rules, and mount targets, configure protocols, storage types, permissions, and network settings."
  },
  "Parameters": {
    "Description": {
      "Type": "String",
      "Description": "File system description.",
      "Default": "mytest"
    },
    "ProtocolType": {
      "Type": "String",
      "Description": "Type of protocol used.",
      "Default": "NFS",
      "AllowedValues": [
        "NFS",
        "SMB"
      ]
    },
    "StorageType": {
      "Type": "String",
      "Description": "The file system type.",
      "Default": "Capacity",
      "AllowedValues": [
        "Performance",
        "Capacity"
      ]
    },
    "AccessGroupName": {
      "Type": "String",
      "Default": "mytest"
    },
    "VSwitchId": {
      "Type": "String"
    },
    "VpcId": {
      "Type": "String"
    },
    "Priority": {
      "Type": "Number",
      "Description": "Allowed Values: 1~100",
      "Default": 1,
      "MinValue": 1,
      "MaxValue": 100
    },
    "UserAccessType": {
      "Type": "String",
      "Default": "no_squash",
      "AllowedValues": [
        "no_squash",
        "root_squash",
        "all_squash"
      ]
    },
    "SourceCidrIp": {
      "Type": "String",
      "Description": "Address or address segment",
      "Default": "0.0.0.0/0"
    },
    "RWAccessType": {
      "Type": "String",
      "Description": "Read-write permission type: RDWR (default), RDONLY",
      "Default": "RDWR",
      "AllowedValues": [
        "RDWR",
        "RDONLY"
      ]
    }
  },
  "Resources": {
    "FileSystem": {
      "Type": "ALIYUN::NAS::FileSystem",
      "Properties": {
        "ProtocolType": {
          "Ref": "ProtocolType"
        },
        "StorageType": {
          "Ref": "StorageType"
        },
        "Description": {
          "Ref": "Description"
        }
      }
    },
    "AccessGroup": {
      "Type": "ALIYUN::NAS::AccessGroup",
      "Properties": {
        "AccessGroupType": "Vpc",
        "AccessGroupName": {
          "Ref": "AccessGroupName"
        }
      }
    },
    "AccessRule": {
      "Type": "ALIYUN::NAS::AccessRule",
      "Properties": {
        "Priority": {
          "Ref": "Priority"
        },
        "UserAccessType": {
          "Ref": "UserAccessType"
        },
        "AccessGroupName": {
          "Fn::GetAtt": [
            "AccessGroup",
            "AccessGroupName"
          ]
        },
        "SourceCidrIp": {
          "Ref": "SourceCidrIp"
        },
        "RWAccessType": {
          "Ref": "RWAccessType"
        }
      },
      "DependsOn": "AccessGroup"
    },
    "MountTarget": {
      "Type": "ALIYUN::NAS::MountTarget",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "FileSystemId": {
          "Fn::GetAtt": [
            "FileSystem",
            "FileSystemId"
          ]
        },
        "NetworkType": "Vpc",
        "AccessGroupName": {
          "Fn::GetAtt": [
            "AccessGroup",
            "AccessGroupName"
          ]
        }
      },
      "DependsOn": [
        "AccessRule",
        "FileSystem"
      ]
    }
  },
  "Outputs": {
    "FileSystemId": {
      "Description": "ID of the file system created",
      "Value": {
        "Fn::GetAtt": [
          "FileSystem",
          "FileSystemId"
        ]
      }
    },
    "AccessGroupName": {
      "Description": "Permission group name",
      "Value": {
        "Fn::GetAtt": [
          "AccessGroup",
          "AccessGroupName"
        ]
      }
    },
    "AccessRuleId": {
      "Value": {
        "Fn::GetAtt": [
          "AccessRule",
          "AccessRuleId"
        ]
      }
    },
    "MountTargetDomain": {
      "Value": {
        "Fn::GetAtt": [
          "MountTarget",
          "MountTargetDomain"
        ]
      }
    }
  }
}

场景 3 :通义千问和LangChain搭建对话模型

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建VPC环境,配置安全组,搭建NFS文件系统,启用PAI服务,部署基于Qwen和LangChain的对话模型WebUI。
  en: Create a VPC environment, configure security groups, set up an NFS file system,
    enable PAI services, and deploy a conversation model WebUI based on Qwen and LangChain.
Parameters:
  ZoneId:
    Type: String
    Label:
      en: VSwitch Availability Zone
      zh-cn: 可用区
    Description:
      en: Availability Zone ID
      zh-cn: 可用区ID。
    AssociationProperty: ZoneId
  PAIEASInstanceType:
    Type: String
    Label:
      en: PAI-EAS instance type.
      zh-cn: PAI-EAS实例规格
    Description:
      en: PAI-EAS instance type.
      zh-cn: PAI-EAS 使用的实例规格。
    AllowedPattern: '(^ecs.*gn.*)|(^ml.*)'
    AssociationProperty: ALIYUN::EAS::Instance::InstanceType
    AssociationPropertyMetadata:
      SubscriptionType: PayAsYouGo
Resources:
  RandomString:
    Type: ALIYUN::RandomString
    Properties:
      length: 8
      character_classes:
        - class: lowercase
          min: 1
        - class: digits
          min: 1
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.0.0/24
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      VpcId:
        Ref: Vpc
      SecurityGroupIngress:
        - PortRange: 80/80
          Priority: 1
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
          NicType: internet
        - PortRange: 443/443
          Priority: 1
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
          NicType: internet
        - PortRange: 3389/3389
          Priority: 1
          SourceCidrIp: 0.0.0.0/0
          IpProtocol: tcp
          NicType: internet
  NasFileSystem:
    Type: ALIYUN::NAS::FileSystem
    Properties:
      ProtocolType: NFS
      FileSystemType: standard
      StorageType: Performance
      DeletionForce: true
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: Vpc
      VSwitchId:
        Ref: VSwitch
  NasAccessGroup:
    Type: ALIYUN::NAS::AccessGroup
    Properties:
      AccessGroupType: Vpc
      AccessGroupName: 
        Fn::Sub: nas-access-group-${ALIYUN::StackId}
  NasMountTarget:
    Type: ALIYUN::NAS::MountTarget
    DependsOn:
    - NasAccessRule
    Properties:
      VpcId:
        Ref: Vpc
      VSwitchId:
        Ref: VSwitch
      NetworkType: Vpc
      AccessGroupName:
        Ref: NasAccessGroup
      FileSystemId:
        Ref: NasFileSystem
  NasAccessRule:
    Type: ALIYUN::NAS::AccessRule
    Properties:
      SourceCidrIp: 0.0.0.0/0
      AccessGroupName:
        Ref: NasAccessGroup
  Workspace:
    Type: ALIYUN::PAI::Workspace
    Properties:
      EnvTypes:
        - dev
        - prod
      Description: Build a dialogue model based on Qwen and LangChain.
      WorkspaceName:
        Fn::Sub: qwen_demo_${RandomString.value}
  EAS:
    Type: ALIYUN::PAI::Service
    Properties:
      ServiceConfig:
        metadata:
          name:
            Fn::Sub: qwen_demo_${RandomString.value}
          instance: 1
          enable_webservice: 'true'
        cloud:
          computing:
            instance_type:
              Ref: PAIEASInstanceType
            instances: Null
        containers:
          - image:
              Fn::Sub:
                - 'eas-registry-vpc.${Region}.cr.aliyuncs.com/pai-eas/chat-llm-webui:2.1'
                - Region:
                    Ref: ALIYUN::Region
            script: 'python webui/webui_server.py --port=8000 --model-path=Qwen/Qwen-7B-Chat'
            port: 8000
    DependsOn:
      - Workspace
Outputs:
  Namespace:
    Description:
      zh-cn: 服务所在的命名空间。
      en: The namespace where the service resides.
    Value:
      Fn::GetAtt:
        - EAS
        - Namespace
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - ZoneId
          - PAIEASInstanceType
    TemplateTags:
      - acs:technical-solution:AI:通义千问和LangChain搭建对话模型
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建VPC环境,配置安全组,搭建NFS文件系统,启用PAI服务,部署基于Qwen和LangChain的对话模型WebUI。",
    "en": "Create a VPC environment, configure security groups, set up an NFS file system, enable PAI services, and deploy a conversation model WebUI based on Qwen and LangChain."
  },
  "Parameters": {
    "ZoneId": {
      "Type": "String",
      "Label": {
        "en": "VSwitch Availability Zone",
        "zh-cn": "可用区"
      },
      "Description": {
        "en": "Availability Zone ID",
        "zh-cn": "可用区ID。"
      },
      "AssociationProperty": "ZoneId"
    },
    "PAIEASInstanceType": {
      "Type": "String",
      "Label": {
        "en": "PAI-EAS instance type.",
        "zh-cn": "PAI-EAS实例规格"
      },
      "Description": {
        "en": "PAI-EAS instance type.",
        "zh-cn": "PAI-EAS 使用的实例规格。"
      },
      "AllowedPattern": "(^ecs.*gn.*)|(^ml.*)",
      "AssociationProperty": "ALIYUN::EAS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "SubscriptionType": "PayAsYouGo"
      }
    }
  },
  "Resources": {
    "RandomString": {
      "Type": "ALIYUN::RandomString",
      "Properties": {
        "length": 8,
        "character_classes": [
          {
            "class": "lowercase",
            "min": 1
          },
          {
            "class": "digits",
            "min": 1
          }
        ]
      }
    },
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.0.0/24"
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupIngress": [
          {
            "PortRange": "80/80",
            "Priority": 1,
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp",
            "NicType": "internet"
          },
          {
            "PortRange": "443/443",
            "Priority": 1,
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp",
            "NicType": "internet"
          },
          {
            "PortRange": "3389/3389",
            "Priority": 1,
            "SourceCidrIp": "0.0.0.0/0",
            "IpProtocol": "tcp",
            "NicType": "internet"
          }
        ]
      }
    },
    "NasFileSystem": {
      "Type": "ALIYUN::NAS::FileSystem",
      "Properties": {
        "ProtocolType": "NFS",
        "FileSystemType": "standard",
        "StorageType": "Performance",
        "DeletionForce": true,
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        }
      }
    },
    "NasAccessGroup": {
      "Type": "ALIYUN::NAS::AccessGroup",
      "Properties": {
        "AccessGroupType": "Vpc",
        "AccessGroupName": {
          "Fn::Sub": "nas-access-group-${ALIYUN::StackId}"
        }
      }
    },
    "NasMountTarget": {
      "Type": "ALIYUN::NAS::MountTarget",
      "DependsOn": [
        "NasAccessRule"
      ],
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "NetworkType": "Vpc",
        "AccessGroupName": {
          "Ref": "NasAccessGroup"
        },
        "FileSystemId": {
          "Ref": "NasFileSystem"
        }
      }
    },
    "NasAccessRule": {
      "Type": "ALIYUN::NAS::AccessRule",
      "Properties": {
        "SourceCidrIp": "0.0.0.0/0",
        "AccessGroupName": {
          "Ref": "NasAccessGroup"
        }
      }
    },
    "Workspace": {
      "Type": "ALIYUN::PAI::Workspace",
      "Properties": {
        "EnvTypes": [
          "dev",
          "prod"
        ],
        "Description": "Build a dialogue model based on Qwen and LangChain.",
        "WorkspaceName": {
          "Fn::Sub": "qwen_demo_${RandomString.value}"
        }
      }
    },
    "EAS": {
      "Type": "ALIYUN::PAI::Service",
      "Properties": {
        "ServiceConfig": {
          "metadata": {
            "name": {
              "Fn::Sub": "qwen_demo_${RandomString.value}"
            },
            "instance": 1,
            "enable_webservice": "true"
          },
          "cloud": {
            "computing": {
              "instance_type": {
                "Ref": "PAIEASInstanceType"
              },
              "instances": null
            }
          },
          "containers": [
            {
              "image": {
                "Fn::Sub": [
                  "eas-registry-vpc.${Region}.cr.aliyuncs.com/pai-eas/chat-llm-webui:2.1",
                  {
                    "Region": {
                      "Ref": "ALIYUN::Region"
                    }
                  }
                ]
              },
              "script": "python webui/webui_server.py --port=8000 --model-path=Qwen/Qwen-7B-Chat",
              "port": 8000
            }
          ]
        }
      },
      "DependsOn": [
        "Workspace"
      ]
    }
  },
  "Outputs": {
    "Namespace": {
      "Description": {
        "zh-cn": "服务所在的命名空间。",
        "en": "The namespace where the service resides."
      },
      "Value": {
        "Fn::GetAtt": [
          "EAS",
          "Namespace"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId",
            "PAIEASInstanceType"
          ]
        }
      ],
      "TemplateTags": [
        "acs:technical-solution:AI:通义千问和LangChain搭建对话模型"
      ]
    }
  }
}