All Products
Search
Document Center

File Storage NAS:Manage NAS resources with Alibaba Cloud CLI

Last Updated:Feb 27, 2026

Alibaba Cloud Command Line Interface (CLI) is a command-line tool built on Alibaba Cloud APIs. Use it to manage File Storage NAS resources from your shell. This topic covers CLI installation, credential configuration, command syntax, and examples of creating NAS resources.

Prerequisites

  • An Alibaba Cloud account. For security, use a Resource Access Management (RAM) user instead of your Alibaba Cloud account for API calls and routine O&M.

  • The AliyunNASFullAccess policy attached to your RAM user.

  • An AccessKey pair (AccessKey ID and AccessKey secret) created for the RAM user. For more information, see Create an AccessKey pair.

Important

An Alibaba Cloud account has permissions to call all API operations. Using an Alibaba Cloud account to perform operations is high-risk. We recommend that you use a RAM user for API calls and routine O&M.

Install Alibaba Cloud CLI

Install Alibaba Cloud CLI on your operating system:

Alternatively, use Cloud Shell to debug CLI commands without a local installation. For more information, see What is Cloud Shell?

For more information about Alibaba Cloud CLI, see What is Alibaba Cloud CLI?

Configure credentials

Configure an AccessKey pair and the default region ID before using Alibaba Cloud CLI. Alibaba Cloud CLI supports various identity credential types. For more information, see Identity credential types. The following steps use AccessKey credentials.

  1. Create a RAM user and grant appropriate permissions. For more information, see Create a RAM user and Grant permissions to a RAM user.

  2. Create an AccessKey pair for the RAM user. Record the AccessKey ID and AccessKey secret for the next step. For more information, see Create an AccessKey pair.

  3. Specify a region ID. Alibaba Cloud CLI calls API operations in the specified region. For available regions, see Endpoints.

  4. Configure the AccessKey pair in a CLI profile named AkProfile. For more information, see Configuration examples.

CLI syntax

Run NAS commands with the following syntax. For more information, see Syntax.

aliyun <command> <subcommand> [options and parameters]

Command options

Command options change command behavior or enable extended features. The following options are frequently used:

  • --profile <profileName> -- Override the default credential and environment variable configurations. Use the specified profile to run the command.

  • --help -- Display help information for a command. For more information, see Use the help command.

Examples

Note

The following examples use Command Prompt on Windows. Parameter formats vary across operating systems. For more information, see Parameter formats.

Create a file system

Call the CreateFileSystem operation to create a pay-as-you-go General-purpose Capacity NAS file system with the NFS protocol.

aliyun nas CreateFileSystem ^
  --FileSystemType standard ^
  --ChargeType PayAsYouGo ^
  --StorageType Capacity ^
  --ProtocolType NFS

Expected output:

{
    "FileSystemId": "6a2464****",
    "RequestId": "3879AB9C-1DED-5A49-A015-350138B23BF0"
}

The response returns a FileSystemId that uniquely identifies the file system.

Create a permission group

Call the CreateAccessGroup operation to create a permission group (referred to as AccessGroup in the API) named vpc_test.

aliyun nas CreateAccessGroup ^
  --AccessGroupName vpc_test ^
  --AccessGroupType Vpc

Expected output:

{
    "AccessGroupName": "vpc_test",
    "RequestId": "95CB3005-C251-5E11-A949-29CB2C7A9C54"
}

The response confirms the permission group name in the AccessGroupName field.

Generate commands from OpenAPI Portal

Use OpenAPI Portal to generate CLI commands interactively.

  1. Log on to OpenAPI Portal and select File Storage NAS.

  2. Search for an API operation in the left-side search box.

  3. On the Parameters tab, specify the required parameters.

  4. Click the CLI Example tab on the right side to view the generated command.

OpenAPI Portal CLI Example

From the CLI Example tab:

  • Click the Run Command icon to launch Cloud Shell and run the command directly.

  • Click the Copy icon to copy the command to your clipboard.

When copying commands, note the following:

  • Check parameter formats before pasting into your local shell. Formats vary by operating system. For more information, see Parameter formats.

  • The generated command includes a --region option by default. This option takes priority over the region in your default credentials and environment variables. Remove or keep it based on your requirements.

Error handling and troubleshooting

If an API call returns an error, verify that the request parameters and values are valid based on the returned error code.

For self-service diagnostics, use the returned request ID or SDK error information on the OpenAPI problem diagnosis page.

What's next