HostOnNet Blog


Creating Google Cloud Storage using gsutil

Google Cloud Storage is similar to Amazon S3, you create Buckets and store files in it.

gsutil is a command line program that is part of google cloud sdk used to interact with Google Cloud Storage. Before you can use gsutil, you need to use gcloud command to login to your google cloud account.

For more info, see https://blog.hostonnet.com/gcloud

The command is

gcloud auth login

Once logged in, you are ready to use gsutil.

Listing all Google Cloud Storage Buckets

gsutil list

Example

boby@hon-pc-01:~ $ gsutil list
gs://cp100-166620.appspot.com/
gs://staging.cp100-166620.appspot.com/
boby@hon-pc-01:~ $ 

Create a Google Cloud Storage Bucket

gsutil mb (make bucket) command is used to create bucket.

gsutil mb gs://BUCKET-NAME-HERE

Example

boby@hon-pc-01:~ $ gsutil mb gs://hostonnet
Creating gs://hostonnet/...
boby@hon-pc-01:~ $ 

Lets list all available buckets now

boby@hon-pc-01:~ $ gsutil list
gs://cp100-166620.appspot.com/
gs://hostonnet/
gs://staging.cp100-166620.appspot.com/
boby@hon-pc-01:~ $ 

To get help on gsutil mb command, run

gsutil mb --help

Make a bucket public

To make use a bucket as CDN, you need to allow users to access bucket with out login

gsutil defacl ch -u AllUsers:R gs://BUCKET-NAME-HERE

Example

boby@hon-pc-01:~ $ gsutil defacl ch -u AllUsers:R gs://hostonnet
Updated default ACL on gs://hostonnet/
boby@hon-pc-01:~ $ 

Posted in Cloud