Google Cloud Storage¶
Install¶
This installs google-cloud-storage.
Credential setup¶
nexus-fs uses Google Application Default Credentials (ADC). Configure one of:
Option 1: gcloud CLI¶
This stores credentials at ~/.config/gcloud/application_default_credentials.json.
Option 2: Service account key¶
Option 3: Compute Engine / Cloud Run / GKE¶
No configuration needed. The metadata service provides credentials automatically.
Verify credentials¶
Mount¶
The GCS URI format is gcs://<project>/<bucket>. The mount point uses the bucket name only: /gcs/my-bucket/.
Mount path¶
| URI | Mount point |
|---|---|
gcs://my-project/data-bucket | /gcs/data-bucket/ |
gcs://analytics/warehouse | /gcs/warehouse/ |
Override with at=:
Common patterns¶
Read and write¶
# skip-test
import nexus.fs
fs = nexus.fs.mount_sync("gcs://my-project/my-bucket")
fs.write("/gcs/my-bucket/config.yaml", b"key: value\n")
content = fs.read("/gcs/my-bucket/config.yaml")
List objects¶
# skip-test
import nexus.fs
fs = nexus.fs.mount_sync("gcs://my-project/my-bucket")
files = fs.ls("/gcs/my-bucket/datasets/")
entries = fs.ls("/gcs/my-bucket/datasets/", detail=True)
Cross-backend operations¶
# skip-test
import nexus.fs
fs = nexus.fs.mount_sync(
"gcs://my-project/my-bucket",
"s3://my-s3-bucket",
"local://./scratch",
)
# Read from GCS, write to S3 — same API
data = fs.read("/gcs/my-bucket/input.csv")
fs.write("/s3/my-s3-bucket/input.csv", data)