Mounting a bucket to a function
Written by
Updated at February 6, 2024
Note
This feature is in the Preview stage. You can only mount a read-only bucket by default. To mount a bucket with write permissions, contact tech support
Management console
API
- In the management console
, select the folder containing your function. - Select Cloud Functions.
- Select a function.
- Go to the Editor tab.
- In block Parameters, select or create a new service account with the role:
storage.viewer
to only read data from the mounted bucket.storage.uploader
to read and write the mounted bucket data.
- Under Mounted buckets, click Add bucket.
- Specify the following in the field:
- Mount point: Name of the mount point. The directory where the bucket is mounted will be accessible at the
/function/storage/<mount_point>
path. - Bucket: Name of the bucket you want to mount. Alternatively, you can create a new bucket.
- Folder: Folder within the bucket. If you leave this field empty, the entire bucket will be mounted.
- Mount point: Name of the mount point. The directory where the bucket is mounted will be accessible at the
- Click Save changes.
To mount a bucket, use the createVersion REST API method for the Function resource or the FunctionService/CreateVersion gRPC API call.