Creates a file system.

Description

  • Before you call this operation, you must understand the billing and pricing of Apsara File Storage NAS. For more information, see Billing and Pricing.
  • Before you create a file system, you must complete real-name verification.
  • When you call this operation, a service-linked role of NAS is automatically created. For more information, see Manage the service-linked roles of NAS.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateFileSystem

The operation that you want to perform.

Set the value to CreateFileSystem.

FileSystemType String No standard

The type of the file system.

Default value: standard. Valid values:

  • standard: General-purpose NAS file system
  • extreme: Extreme NAS file system
  • cpfs: Cloud Paralleled File System (CPFS)
ChargeType String No PayAsYouGo

The billing method of the file system.

Valid values:

  • PayAsYouGo: pay-as-you-go
  • Subscription: subscription
Duration Integer No 1

The subscription duration of the file system.

This parameter is valid and required only if the ChargeType parameter is set to Subscription. Unit: months.

If you do not renew a subscription file system when the file system expires, the file system is automatically stopped.

Capacity Long No 100

The capacity of the file system.

This parameter is valid and required only if the FileSystemType parameter is set to extreme or cpfs. Unit: GiB.

For more information about how to select specifications, go to the following buy pages:

Bandwidth Long No 150

The maximum throughput of the file system.

Unit: MB/s.

For more information about how to select specifications, go to the following buy pages:

StorageType String Yes Performance

The storage type.

  • If the FileSystemType parameter is set to standard, you can set the StorageType parameter to Performance or Capacity.
  • If the FileSystemType parameter is set to extreme, you can set the StorageType parameter to standard or advance.
  • If the FileSystemType parameter is set to cpfs, you can set the StorageType parameter to advance_100 (100 MB/s/TiB baseline) or advance_200 (200 MB/s/TiB baseline).
ZoneId String No cn-hangzhou-b

The zone ID.

Each region consists of multiple isolated locations known as zones. Each zone has an independent power supply and network.

This parameter is not required if the FileSystemType parameter is set to standard. By default, a random zone is selected based on the protocol type and storage type. This parameter is required if the FileSystemType parameter is set to extreme or cpfs.

Note
  • An Elastic Compute Service (ECS) instance can access or be accessed by a file system in a different zone of the same region.
  • To prevent cross-zone latency, we recommend that you deploy the file system and the ECS instance in the same zone.
ProtocolType String Yes NFS

The protocol type.

  • If the FileSystemType parameter is set to standard, you can set the protocol type to NFS or SMB.
  • If the FileSystemType parameter is set to extreme, you can set the protocol type to NFS.
  • If the FileSystemType parameter is set to cpfs, you can set the protocol type to cpfs.
EncryptType Integer No 1

Specifies whether to encrypt the file system.

You can use keys that are managed by Key Management Service (KMS) to encrypt the data in the file system. When you access the encrypted data, the data is automatically decrypted.

Default value: 0. Valid values:

  • 0: The data in the file system is not encrypted.
  • 1: NAS-managed keys are used to encrypt the data in the file system. This parameter is valid only if the FileSystemType parameter is set to standard or extreme.
  • 2: User-managed keys are used to encrypt the data in the file system. This parameter is valid only if the FileSystemType parameter is set to extreme.
SnapshotId String No s-xxx

The ID of the snapshot.

This parameter is available only for Extreme NAS file systems.

Note You can create a file system from a snapshot. In this case, the version of the file system is the same as that of the source file system. For example, the source file system of the snapshot uses version 1. To create a file system of version 2, you can create File System A from the snapshot and create File System B of version 2. You can then copy the data and migrate your business from File System A to File System B.
VpcId String No N/A

The ID of the virtual private cloud (VPC).

This parameter must be specified if you set the FileSystemType parameter to cpfs.

This parameter is reserved and not required if you set the FileSystemType parameter to standard or extreme.

VSwitchId String No N/A

The ID of the vSwitch.

This parameter must be specified if you set the FileSystemType parameter to cpfs.

This parameter is reserved and not required if you set the FileSystemType parameter to standard or extreme.

Description String No The description of the file system.

The description of the file system.

Limits:

  • The description must be 2 to 128 characters in length.
  • It must start with a letter but cannot start with http:// or https://.
  • The description can contain digits, colons (:), underscores (_), and hyphens (-).
ClientToken String No 123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. However, the IDs of different requests may be different.
KmsKeyId String No N/A

The ID of the key that is managed by KMS.

This parameter is required only if the EncryptType parameter is set to 2.

DryRun Boolean No true

Specifies whether to perform a dry run for the request.

The dry run checks whether the request parameters are valid and whether the requested resources are available. The dry run does not create a file system or incur fees.

Valid values:

  • true: A dry run request is sent and no file system is created. The check items include the request format, service limits, available NAS resources, and whether the required parameters are set. If the dry run fails, an error message is returned. If the dry run succeeds, the HTTP status code 200 is returned. However, no value is returned for the FileSystemId parameter.
  • false (default value): A request is sent, and a file system is created after the dry run succeeds.

Take note of the following information about API idempotence:

The CreateFileSystem operation creates a file system and incurs fees. Therefore, if the request times out or an internal error occurs, the client may attempt to resend the request. In this case, you can specify the ClientToken parameter in the request. This ensures that the request is not repeatedly sent by the client.

The following list provides more details about the ClientToken parameter.

  • A client token is a unique and case-sensitive string that is generated by the client. The token can contain only ASCII characters and cannot exceed 64 characters in length. Example:
    ClientToken=123e4567-e89b-12d3-a456-426655440000
  • If you specify a used client token and modify other request parameters, the ECS instance returns the IdempotentParameterMismatch error code.
    Note If you call the operation again, you must change the values of the SignatureNonce, Timestamp, and Signature parameters. This is because the ECS instance uses the SignatureNonce parameter to prevent replay attacks and uses the Timestamp parameter to identify the timestamp of each request. Therefore, a retry request requires different values of the SignatureNonce and Timestamp parameters. In this case, the value of the Signature parameter changes.
  • If you specify the ClientToken parameter and the request fails, the request is resent based on the following HTTP status codes and error messages:
    • If the HTTP status code 200 is returned, the client can receive the same result as the last request after the request is resent. However, your server status is not affected.
    • If a 4xx HTTP status code is returned and the error message does not indicate "try it later", the request parameters are invalid. In this case, you must modify the request parameters based on the returned error message and then resend the request.
    • If a 5xx HTTP status code is returned, a network timeout or an internal error occurred. In this case, you can resend the same request and the request must contain the same client token and request parameters.
  • A client token is valid for 30 days.

Response parameters

Parameter Type Example Description
RequestId String 98696EF0-1607-4E9D-B01D-F20930B6****

The ID of the request.

FileSystemId String 1ca404****

The ID of the file system that is created.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateFileSystem
&EncryptType=1
&ProtocolType=NFS
&StorageType=Performance
&ZoneId=cn-hangzhou-b
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateFileSystemResponse>
    <FileSystemId>1ca404****</FileSystemId>
    <RequestId>98696EF0-1607-4E9D-B01D-F20930B6****</RequestId>
</CreateFileSystemResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "CreateFileSystemResponse" : {
    "FileSystemId" : "1ca404****",
    "RequestId" : "98696EF0-1607-4E9D-B01D-F20930B6****"
  }
}

Error codes

HttpCode Error code Error message Description
202 RequestAccepted The request has been accepted by the server. The message returned because the request has been accepted by the backend.
400 IdempotentParameterMismatch The same client token was passed in to different parameters. The error message returned because the same client token is specified in different parameters.
400 InvalidParameter.KmsServiceNotEnabled Key Management Service is not enabled. The error message returned because KMS is disabled.
400 DryRunOperation The request is validated with DryRun flag set. The message returned because the dry run request is validated.
400 SubAccount.NoExtremeSLRPermission The RAM user does not have the permission to create service linked role AliyunServiceRoleForNasExtreme. Please authorize the RAM user the permission ram:CreateServiceLinkedRole. The error message returned because the current RAM user is not authorized to create the service-linked role AliyunServiceRoleForNasExtreme. Grant the ram:CreateServiceLinkedRole permission to the RAM user.
400 SubAccount.NoStandardSLRPermission The RAM user does not have the permission to create service linked role AliyunServiceRoleForNasStandard. Please authorize the RAM user the permission ram:CreateServiceLinkedRole. The error message returned because the current RAM user is not authorized to create the service-linked role AliyunServiceRoleForNasStandard. Grant the ram:CreateServiceLinkedRole permission to the RAM user.
400 SubAccount.NoEncryptionSLRPermission The RAM user does not have the permission to create service linked role AliyunServiceRoleForNasEncryption. Please authorize the RAM user the permission ram:CreateServiceLinkedRole. The error message returned because the RAM user is not authorized to create the service-linked role AliyunServiceRoleForNasEncryption. Grant the ram:CreateServiceLinkedRole permission to the RAM user.
400 InvalidParam.NotSupportBYOK The specified file system type does not support the BYOK encryption function. The error message returned because the specified file system type does not support KMS encryption.
400 MissingParameter.KmsKeyId When parameter EncryptType equals 2, the parameter KmsKeyId is mandatory for your request. The error message returned because the KmsKeyId is not specified. If KMS encryption is used, you must specify the KmsKeyId parameter.
403 OperationDenied.InvalidState The operation is not permitted when the status is processing. The error message returned because the file system is in an invalid state.
403 InvalidFileSystem.AlreadyExisted The specified file system already exists. The error message returned because the specified file system already exists.
403 Resource.OutOfStock The inventory of the specified zone is insufficient. The error message returned because the available resources in the specified zone are insufficient.

For a list of error codes, visit the API Error Center.