以下の内容はhttps://htn20190109.hatenablog.com/entry/2024/11/12/230637より取得しました。


{GCP Cloud Storage}アクセス制御リスト(ACL)の作成と管理

 

https://cloud.google.com/storage/docs/access-control/create-manage-lists?hl=ja

https://cloud.google.com/storage/docs/access-control/lists?hl=ja

 

 

-- 1. 前作業

gcloud init
gcloud auth list

gcloud --version

gcloud projects create project01-9999999 \
--name="project01"

gcloud config list
gcloud config set project project01-9999999
gcloud config set compute/region asia-northeast1 --quiet
gcloud config set compute/zone asia-northeast1-a --quiet

gcloud beta billing accounts list
gcloud beta billing projects link project01-9999999 --billing-account=111111-111111-111111

gcloud services enable compute.googleapis.com --project project01-9999999

gcloud components update

 

-- 2. バケットの作成

gcloud storage buckets create gs://bucket99999999 \
--default-storage-class=Standard \
--no-enable-autoclass \
--location=asia-northeast1 \
--no-public-access-prevention \
--no-uniform-bucket-level-access


gcloud storage ls


-- 3. ファイルのアップロード


echo test1 > test1.txt
echo test2 > test2.txt

gcloud storage cp test1.txt gs://bucket99999999
gcloud storage cp test2.txt gs://bucket99999999

gcloud storage ls --long gs://bucket99999999/*

 

-- 4. ACL の設定

gcloud storage objects update gs://bucket99999999/test1.txt --add-acl-grant=entity=user-hoge@example.com,role=OWNER
gcloud storage objects update gs://bucket99999999/test2.txt --add-acl-grant=entity=allUsers,role=READER

 

gcloud storage objects describe gs://bucket99999999/test1.txt --format="default(acl)"
gcloud storage objects describe gs://bucket99999999/test2.txt --format="default(acl)"

 

 

-- 5. 動作確認

curl https://storage.googleapis.com/bucket99999999/test1.txt

curl https://storage.googleapis.com/bucket99999999/test2.txt

 

 

-- 6. クリーンアップ

gcloud storage rm gs://bucket99999999 --recursive
gcloud storage ls

 

gcloud projects list

gcloud projects delete project01-9999999 \
--quiet

 


gcloud beta billing projects unlink project01-9999999

 




以上の内容はhttps://htn20190109.hatenablog.com/entry/2024/11/12/230637より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14