Storage
List Buckets
gcloud storage buckets list --format "table(name)"
NAME
dev-assets
stage-assets
prod-assets
terraform-state
List Objects
gcloud storage ls gs://dev-assets
Delete Object
gcloud storage rm gs://dev-assets/dist/js/app.min.js
Copy From Local
gcloud storage cp ./app.min.js gs://dev-assets/dist/js/app.min.js
Copy From Bucket
gcloud storage cp gs://dev-assets/dist/js/app.min.js ./app.min.js
Create Public Bucket
gcloud storage buckets create gs://dev-assets --no-public-access-prevention
Create Public Object
gcloud storage objects update gs://dev-assets/dist/js/app.min.js --add-acl-grant=entity=allUsers,role=READER
Update Bucket CORS Policy
gcloud storage buckets update gs://dev-assets --cors-file cors.json
[
{
"origin": ["https://example.com"],
"method": ["GET"],
"responseHeader": ["Content-Type"],
"maxAgeSeconds": 3600
}
]