Managing Google Cloud Storage using gCloud SDK
- In the Cloud Console, in the top right toolbar, click the Activate Cloud Shell button.
- Click Continue.
- (Optional) You can list the active account name with this command:
gcloud auth list
- (Optional) You can list the project ID with this command:
gcloud config list project
- Create a bucket
gsutil mb gs://<bucket-name>
-
Upload an object into your bucket curl https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Ada_Lovelace_portrait.jpg/800px-Ada_Lovelace_portrait.jpg --output ada.jpg gsutil cp ada.jpg gs://YOUR-BUCKET-NAME rm ada.jpg
- Download an object from your bucket
gsutil cp -r gs://YOUR-BUCKET-NAME/ada.jpg .
- Copy an object to a folder in the bucket
gsutil cp gs://YOUR-BUCKET-NAME/ada.jpg gs://YOUR-BUCKET-NAME/image-folder/
- List contents of a bucket or folder
gsutil ls gs://YOUR-BUCKET-NAME
- List details for an object
gsutil ls -l gs://YOUR-BUCKET-NAME/ada.jpg
- Make your object publicly accessible
gsutil acl ch -u AllUsers:R gs://YOUR-BUCKET-NAME/ada.jpg
- Remove public access
gsutil acl ch -d AllUsers gs://YOUR-BUCKET-NAME/ada.jpg
- Delete objects
gsutil rm gs://YOUR-BUCKET-NAME/ada.jpg
Tag:Google Cloud