Tencent Cloud File Storage (CFS) provides a scalable shared file storage service that can be used with various Tencent Cloud services such as CVM, TKE, and batch operations. The standard NFS file system access protocol used by CFS offers shared data sources for multiple computing nodes. It supports elastic capacity and performance scaling. Your existing applications can be mounted for use without modification required. As a highly available and reliable distributed file system, CFS is suitable for various scenarios such as big data analysis, media processing, and content management.
CFS is very cost-effective and pay-as-you-go on an hourly basis, so you only need to pay for the actually used storage space. For more information on CFS billing, please see Billing Overview.
Tencent Cloud SCF can be seamlessly integrated with CFS. After proper configuration, your functions can easily access files stored in CFS. You can enjoy the following advantages of CFS:
Note:
To use the CFS service, you need to grant SCF the operation permission to your CFS resources.
To use CFS features, please authorize your account in the following steps:
Associate the SCF_QcsRole
role with the QcloudCFSReadOnlyAccess
policy as instructed in Modifying Role.
If you don't perform this operation for your currently used account, problems such as failures in saving functions and unavailability of CFS features may occur.
If the currently used account is a sub-account, please request the root account to associate the sub-account with the QcloudCFSReadOnlyAccess
policy as instructed in Setting Sub-user Permission.
If you don't perform this operation for your currently used sub-account, problems such as unavailability of CFS features may occur.
Please create a VPC as instructed in Quickly Building IPv4 VPC.
Please create a CFS resource as instructed in Creating CFS File System.
Note:
Currently, SCF allows only CFS file systems whose network type is VPC to be added as mount targets. When creating a CFS file system, please select the same VPC as that of the target function, so as to enable communication.
Log in to the SCF Console and select Function Service on the left sidebar.
On the Function Service page, select the name of the function to be configured.
On the Function Configuration tab of the Function Management page, click Edit in the top-right corner.
In VPC" section, check Enable and select the VPC where the CFS file system resides.
In File System section, check Enable and enter the following information to mount the file system.
/mnt/
directory to mount the CFS file system.Click Save at the bottom to complete the configuration.
You can use the following function code to start using CFS.
'use strict';
var fs = requiret('fs');
exports.main_handler = async (event, context) => {
await fs.promises.writeFile('/mnt/myfolder/filel.txt', JSON.stringify(event));
return event;
};
You can use this script to test the performance of SCF when using CFS.
Was this page helpful?