Wiki > gsutil
gsutil is a tool written in Python that lets you access the Google Storage cloud from the command line. It allows you to do the following:
- Create and delete buckets.
- Upload, download, and delete objects.
- List buckets and objects.
- Move, copy, and rename objects.
- Edit object and bucket ACLs.
This guide will cover how to install gsutil onto your slot. It won't go into detail in how to set up Google Cloud Platform, however.
Connect to your slot through SSH
Create the installation directory for gsutil
Download the gsutil source
Extract the source and enter the directory
tar -zxf gsutil.tar.gz; cd gsutil
Configure gsutil to work with your Google Cloud Platform. Follow the steps in the configure process, it is self explanatory.
Add the following line to
~/.bashrcto add the executable to your PATH environment variable. This will allow you to simply type
gsutilto use gsutil.
~/.bashrcto be able to use the newly added commands.
(Optional) Clean up the setup files.
cd .. rm -rf gsutil gsutil.tar.gz
gsutil should now be installed in
~/.config/gsutil/. The next part shall detail how one might use it.
To use gsutil, simply do the following:
To view the list of available commands:
Copying file to a Google Cloud Platform Storage Bucket using gsutil
This short guide will detail how to copy a file to a Storage Bucket using gsutil.
Create a file to copy to the Storage Bucket.
Copy the file to the Storage bucket using gsutil.
gsutil cp testfile gs://my_bucket
The file should successfully transfer to the Storage Bucket.
This completes the guide on how to set up gsutil on your slot.
Full detailed information about gsutil can be found on the gsutil Tool Page.