Apsara File Storage NAS is a distributed file system that offers secure, reliable, unlimited-capacity, high-performance, and easy-to-use file storage services for compute nodes, such as Elastic Compute Service (ECS), Elastic High Performance Computing (E-HPC), Docker, and Batch Compute.
Function Compute can seamlessly integrate with NAS. This allows your functions to access files in a NAS file system as they do in the on-premises file system. You need only to configure a NAS file system for a specified service, including the region, mount target, and group. After you configure the NAS file system, all functions in the service can access files in the NAS file system as they do in the on-premises file system.
- Temporary files can be stored in a NAS file system, and the file size is not limited.
- Multiple functions can use one NAS file system to share files.
Configure a NAS file system
The NAS configuration is set on the service level. After a NAS mount target is configured for a service, all functions in the service can access files in the specified NAS file system.
- Log on to the Function Compute console.
- In the top navigation bar, select a region.
- In the left-side navigation pane, click Services and Functions.
- On the Services and Functions page, click the service that you require. Then, click the Service Configurations tab. On the Service Configurations tab, click Modify Configuration.
- In the NAS File System section, set the parameters and click Submit.
Parameter Description Remarks UserId Enter a custom user ID. For more information, see the NAS users and user groups section of this topic. GroupId Enter a custom group ID. NAS Mount Point Select a created NAS mount target. For more information, see the Configure a NAS mount target section of this topic. Remote Path Enter a remote directory. Local Mount Path Enter an on-premises directory.
NAS users and user groups
When you configure a NAS mount target for a function, you must first set the UserId and GroupId parameters, which are equivalent to the user and user group in NAS. You must set the file owner and the corresponding group permissions as needed to ensure the consistency of read and write permissions on files.
The values of the UserId and GroupId parameters range from -1 to 65534, excluding 0. The default value is -1. Function Compute does not allow access from root users, which ensures the execution security. The UserId and GroupId parameters are optional. If you do not set the UserId parameter, the system uses the default value of -1. If you do not set the GroupId parameter, the system uses the UserId value as the GroupId value.
We recommend that you set the UserId and GroupId parameters to specific values that range from 1 to 65534 so that all functions of the service can share these files.
Configure a NAS mount target
Configure the NAS mount target in the second part of the NAS configuration. A maximum of five NAS mount targets can be configured for a service.
Each mount target configuration consists of a remote directory and an on-premises directory. An on-premises directory in the on-premises file system is mapped to a remote directory in a NAS file system.
- Remote directory
A remote directory is a directory that the service needs to access in a NAS file system, which consists of a mount target and the absolute directory. You can add mount targets in the NAS console. You can assemble a mount target and the absolute directory into a remote directory. Assume that the mount target of a NAS file system is xxxx-nas.aliyuncs.com and the absolute directory to be accessed is /workspace/document. The full remote directory is xxxx-nas.aliyuncs.com:/workspace/document.
Log on to the NAS console. In the left-side navigation pane, click File System List. On the File System List page, find the file system that you require and click Management in the Operations column. In the left-side navigation pane, click Mounting Use. On the Mount Target page, view the mount target information.
- On-premises directory
An on-premises directory is a mount target in an on-premises file system. Do not use common directories in the Linux or UNIX system, such as bin, opt, var, and dev, to mount NAS file systems. Function Compute allows you to use non-system directories such as mnt and home to mount NAS file systems.
- For more information about how to use Funcraft to configure a NAS file system, see Serverless Application Model and Run, Debug, and Release NAS Configured Functions Locally.
- For more information about how to use SDKs to configure a NAS file system, see Supported SDKs.