パッケージ
pip install --upgrade google-cloud-storage
サービスアカウント
jupyterが乗っているclusterのサービスアカウントに、ストレージ管理者渡す。
データの読み書き
# Imports the Google Cloud client library
from google.cloud import storage
project_name = "riita_project"
storage_client = storage.Client(project_name)
bucket_name = 'riita_bucket'
bucket = storage_client.get_bucket(bucket_name)
# ファイルをアップロード
blob = bucket.blob('保存ファイル名')
blob.upload_from_filename(filename='ローカルファイルパス')
# アップロードしたファイルをダウンロード
blob2 = bucket.get_blob('取得ファイル名')