Mounting file systems to a function
You can mount buckets and one ephemeral disk to a Yandex Cloud Functions function. To avoid data access errors, all mount points for ephemeral disks and buckets must be unique.
Mounting buckets
Mounting buckets allows you to access them through the file system interface. In the function version settings, you can specify one or more mount points. Use this path to access the directory in which the bucket is mounted: /function/storage/<mount_point>
.
You can mount the whole bucket or a specific folder.
To mount a bucket, the service account needs the following roles:
storage.viewer
to only read data from the bucket.storage.uploader
to read and write data from/to the bucket.
Mounting an ephemeral disk
Note
This feature is in the Preview stage. To get access, contact tech support
To mount an ephemeral disk, you can specify a mount point. Use this path to access the directory in which the ephemeral disk is mounted: /function/storage/<mount_point>
.
The ephemeral disk size is a multiple of 1 GB and is set in the range from 1 to 100 GB. The maximum size of the ephemeral disk at the Preview stage cannot exceed 100 GB.
An ephemeral disk of a given size is created when the function is called just before the user code is executed. It is formatted into the ext4
For the entire lifetime of the function, user code is granted read-write access to the ephemeral disk.
If a function is called multiple times, there is a chance that its repeated calls will be processed by the same instance. In this case, the data remaining on the disk after the previous call can be accessed. This function behavior is not determinated, and you cannot rely on the data being saved between calls.
Note
When the function's lifecycle ends, the ephemeral disk is permanently deleted. Use this type of disk space only to save temporary state.