This topic describes how to create a NAS file system and mount it on multiple compute instances to allow shared access to a file system. You can create a General-purpose NAS file system or Extreme NAS file system.

Background information

A General-purpose NAS file system and an Extreme NAS file system have different features and are applicable to different scenarios. For more information, see General-purpose NAS file systems and Extreme NAS file systems.

Create a General-purpose NAS file system in the NAS console

  1. Log on to the NAS console.
  2. In the File System Selection Guide section of the Overview page, click Create a General Purpose NAS File System.
  3. In the Create a General Purpose NAS File System panel, set the parameters. The following table describes the parameters.
    Parameter Description
    Region Select the region where you want to create the file system.
    Note
    • We recommend that you select the region of an Elastic Compute Service (ECS) instance on which you want to mount the file system. Otherwise, the ECS instance cannot access the NAS file system. If a mount target of the file system and the ECS instance reside in different regions, you can use Cloud Enterprise Network (CEN) to enable a cross-region mount for the file system. However, the cross-region mount compromises the transfer performance of the file system. For more information, see Mount a file system across VPCs or regions.
    • You can create a maximum of 20 file systems in a region for each Alibaba Cloud account.
    Zone Select a zone that resides in the region. Each region consists of isolated locations that are known as zones. Each zone has an independent power supply and network. If the ECS instance and the file system reside in different zones of the same region, the ECS instance can access the file system.

    We recommend that you select the zone where the ECS instance resides. This prevents extra latency that is caused by cross-zone communication between the file system and the ECS instance.

    Storage Type Select the storage type of the file system. Valid values: NAS Performance and NAS Capacity.

    For information about the performance comparison between a NAS Capacity file system and a NAS Performance file system, see General-purpose NAS file systems.

    Protocol Type Select the protocol type of the file system. Valid values: NFS and SMB.

    The Network File System (NFS) protocol is applicable to file sharing among Linux ECS instances. The Server Message Block (SMB) protocol is applicable to file sharing among Windows ECS instances.

    Lifecycle Management Specifies whether to enable the lifecycle management feature for the file system.
    • Enable: enables the lifecycle management feature. By default, this feature is enabled after a file system is created.
    • Disable: disables the lifecycle management feature.
    Lifecycle Management Select a lifecycle management policy. After you enable the lifecycle management feature, you must select a lifecycle management policy. For more information, see Manage a lifecycle management policy.
    Encryption Type Select the encryption type of the file system. Valid values:
    • Not Encrypted: Server-side encryption is disabled.
    • NAS-managed Key: You can use NAS-managed keys to encrypt the file system.
    • User Management Key (KMS): You can use custom keys that are hosted by KMS to encrypt and decrypt the file system.

    If you select NAS-managed Key or User Management Key (KMS), the keys that are hosted by KMS are used to encrypt the data in the file system. When you access the encrypted data, the data is automatically decrypted. For more information, see Server-side encryption.

    CMK ID If you select User Management Key (KMS) as the encryption type, select the customer master key (CMK) ID from the drop-down list.
    Key Alias If you select User Management Key (KMS) as the encryption type, you must double-check the key alias.
    Assign SLR If you select User Management Key (KMS) as the encryption role, you must assign the AliyunServiceRoleForNasEncryption role to the file system. For more information, see Service-linked roles of NAS.
    Network Type Select the network type of the mount target. Valid values: VPC and Classic Network.
    Note
    • You can create a mount target in the classic network only in some regions inside China.
    • You can mount a file system only on an ECS instance if you use a mount target in the classic network. The network type of the ECS instance must be the same as that of the mount target. To mount a file system on an ECS instance in the classic network, you must use a mount target that resides in the classic network. To mount a file system on an ECS instance in a virtual private cloud (VPC), you must use a mount target that resides in the VPC.
    VPC If you select VPC as the Network Type, you must select an available VPC where you want to create the mount target. If no VPC is available, create a VPC in the VPC console.
    Note You must select the VPC where the ECS instance resides. If the mount target and the ECS instance reside in different VPCs, you can use CEN to establish a connection between the VPCs. Then, you can mount the file system across the VPCs. For more information, see Mount a file system across VPCs or regions.
    VswitchId If you set Network Type to VPC, you must select a vSwitch that resides in the VPC.
  4. Click Buy Now and complete the payment as prompted.
    Note After the file system is created, the default permission group is attached to the mount target. For information about how to modify the permission group of the mount target, see Manage a permission group.

Create an Extreme NAS file system in the NAS console.

  1. Log on to the NAS console.
  2. In the File System Selection Guide section of the Overview page, click Create an extreme NAS file system.
  3. In the Create an Extreme NAS file system panel, set the parameters. The following table describes the parameters.
    Parameter Description
    Billing Method Select a billing method based on your business requirements. Valid values: Subscription and Pay-As-You-Go. For more information, see Billing of Extreme NAS file systems.
    Region Select the region where you want to create the file system.
    Note
    • We recommend that you select the region of an Elastic Compute Service (ECS) instance on which you want to mount the file system. Otherwise, the ECS instance cannot access the NAS file system. If a mount target of the file system and the ECS instance reside in different regions, you can use Cloud Enterprise Network (CEN) to enable a cross-region mount for the file system. However, the cross-region mount compromises the transfer performance of the file system. For more information, see Mount a file system across VPCs or regions.
    • You can create a maximum of 20 file systems in a region for each Alibaba Cloud account.
    • Only Extreme NAS file systems that reside in the China (Hohhot) region support the IPv6 feature. To enable the IPv6 feature for file systems that reside in other regions, submit a ticket.
    Zone Select a zone that resides in the region. Each region consists of multiple isolated locations that are known as zones. Each zone has an independent power supply and network. If the ECS instance and the file system reside in different zones of the same region, the ECS instance can access the file system.

    We recommend that you select the zone where the ECS instance resides. This prevents extra latency that is caused by cross-zone communication between the file system and the ECS instance.

    Type Select the type of the file system. Valid values:
    • Standard Type: applies to scenarios that require high IOPS, intensive metadata operations, low latency, and moderate throughput to process a large number of small files.
    • Advanced Type: applies to scenarios that require high IOPS, low latency, and moderate throughput to process a large number of small files. The advanced type uses remote direct memory access (RDMA) networking. The latency of read/write operations is reduced and the write performance is improved compared with the standard type.
    Note Each zone supports only one type of Extreme NAS file systems. We recommend that you deploy your business in a zone that supports the advanced type.
    Protocol Select the protocol type of the file system. Extreme NAS file systems support only the NFS protocol.
    Capacity Adjust the slider to control the capacity. Valid values: 100 GiB to 256 TiB.
    Encryption Type Select the type of the file system Valid values:
    • None: Server-side encryption is disabled.
    • NAS-managed Key: You can use NAS-managed keys to encrypt the file system.
    • User Management Key (KMS): You can use custom keys that are hosted by KMS to encrypt and decrypt the file system.

    If you select NAS-managed Key or User Management Key (KMS), the keys that are hosted by KMS are used to encrypt the data in the file system. When you access encrypted data, the data is automatically decrypted. For more information, see Server-side encryption.

    CMK ID If you select User Management Key (KMS) as the encryption type, select the CMK ID from the drop-down list.
    Duration If you select subscription as the billing method, you must select a validity period for the file system. The file system is stopped when the validity period expires. For more information, see Overdue payments.

    We recommend that you select the Auto-renewal check box. After you enable the auto-renewal feature, the file system is automatically renewed on a monthly basis.

  4. Click Buy Now and complete the payment as prompted.

Create an Extreme NAS file system by using a snapshot

You call the NAS API to create an Extreme NAS file system by using a snapshot.

  1. Install NAS SDK for Python.
    pip install aliyun-python-sdk-core
    pip install aliyun-python-sdk-nas
  2. Create a file system.
    • Run the following code to create a pay-as-you-go Extreme NAS file system:
      #!/usr/bin/env python3
      import json
      
      from aliyunsdkcore.client import AcsClient
      from aliyunsdknas.request.v20170626.CreateFileSystemRequest import CreateFileSystemRequest
      
      def create_file_system():
          client = AcsClient('<accessKeyId>', '<accessSecret>', 'cn-hangzhou')
          request = CreateFileSystemRequest()
          request.set_accept_format('json')
          # Pay-as-you-go
          request.set_ChargeType("PayAsYouGo")
          request.set_StorageType("standard")
          request.set_ProtocolType("NFS")
          request.set_FileSystemType("extreme")
          request.set_Capacity("100")
          request.set_ZoneId("cn-hangzhou-h")
          request.set_SnapshotId("s-extreme-xxxxxxxxxx")
      
          response = client.do_action_with_exception(request)
          res = json.loads(response)
          print(res)
    • Run the following code to create a subscription Extreme NAS file system:
      #!/usr/bin/env python3
      import json
      
      from aliyunsdkcore.client import AcsClient
      from aliyunsdknas.request.v20170626.CreateFileSystemRequest import CreateFileSystemRequest
      
      def create_file_system():
          client = AcsClient('<accessKeyId>', '<accessSecret>', 'cn-hangzhou')
          request = CreateFileSystemRequest()
          request.set_accept_format('json')
          # Subscription
          request.set_ChargeType("Subscription")
          request.set_Period(1) # The duration of the subscription. Unit: months.
          request.set_StorageType("standard")
          request.set_ProtocolType("NFS")
          request.set_FileSystemType("extreme")
          request.set_Capacity("100")
          request.set_ZoneId("cn-hangzhou-h")
          request.set_SnapshotId("s-extreme-xxxxxxxxxx")
      
          response = client.do_action_with_exception(request)
          res = json.loads(response)
          print(res)
      In the preceding code, accessKeyId and accessSecret indicate the AccessKey ID and AccessKey secret of your Alibaba Cloud account. For more information, see How can I obtain an AccessKey pair?.

      The Capacity parameter specifies the storage capacity of the Extreme NAS file system. The value of this parameter must be consistent with the storage capacity of the original file system. For example, you create a snapshot named A_Snapshot for a 100 GiB Extreme NAS file system. If you use A_Snapshot to create another file system, you must set the Capacity parameter to 100.

      The value of the StorageType parameter must be consistent with the storage type of the original file system. For example, you have created a snapshot named B_Snapshot for a standard file system. If you use B_Snapshot to create another file system, you must set the StorageType parameter to standard.