How to interact with a Google Cloud Bucket
UI
Downloading
Do more with an object
Note
To do more than downloading an object requires elevated permissions; Storage Object Viewer+Creator or Storage Object Admin
Copy / Move an object
Moving an object in detail
Granting / Revoking access
Info
This is only allowed by elligible UZ Leuven employees cfr. GC-MT113-PR
CLI
Prerequisites
If you want to access the data through the Command Line Interface (CLI) please install gsutil on your device through the Google Cloud CLI. Make sure to authenticate after installation:
gcloud auth login
More info on the gsutil usage can be found here.
Warning
Always ensure you understand the commands you execute to avoid unintended behaviour.
Summary of typical commands
Replace the values in the curly braces {}
Listing files
# List
gsutil ls gs://{BUCKET_NAME}
# Example: List fastq files in a certain folder
gsutil ls gs://{BUCKET_NAME}/{FOLDER}/*.fastq.gz
Copy/Move files
# Copy
gsutil cp {src}/ {dst}/
# Example: from bucket to local machine
gsutil cp gs://{BUCKET_NAME}/{FILE_NAME} {/MY_DEVICE/FILE_DESTINATION/}
# Example: copy a set of csv files
gsutil cp gs://{BUCKET_NAME}/{FOLDER}/*.csv {/MY_DEVICE/FILE_DESTINATION/}
# Example: from your local machine to the bucket
gsutil cp {/MY_DEVICE/FILE_LOCATION/MY_FILE} gs://{BUCKET_NAME}/{OPTIONAL_BUCKET_FOLDER}
# Move; similar to Copy
gsutil mv {src}/ {dst}/
Syncing
One can use gsutil rsync to match source and destination (unidirectional)
gsutil -m rsync -r src/ dst/
Other
# Delete
gsutil rm gs://{BUCKET_NAME}/{FILE_NAME}
# Bucket size
gsutil du -sh gs://{BUCKET_NAME}
# File size
gsutil du -sh gs://{BUCKET_NAME}/{FILE_NAME}