Upload Local Files to Google Cloud Shell
Using an object storage service is frequently the master option in cloud computing. Its benefits, including ease of utilize and modest operational overhead, are extremely appealing to cloud customers. In Google Cloud, the object storage service is provided by the suitably named Google Cloud Storage service. In this article we are going to explicate how to use Google Cloud Storage via the command-line tool gsutil, and other ways to interact with Google Deject Storage. This can be also helpful for users who are getting started with the new NetApp® Cloud Volumes ONTAP for Google Deject. To get started at present, click the links beneath: In object storage, files are simply referenced as objects and organized into buckets—logical namespaces that are able to hold i or more objects. While a bucket tin can have multiple objects, an object can simply belong to only one bucket. The object storage service offered by Google Cloud is called Google Cloud Storage. Google Cloud Storage comes with congenital-in capabilities to manage and automate bucket lifecycle rules .In Google Cloud Storage, the availability of the data can be configured by choosing a storage form for the saucepan and its objects: Standard, Nearline, and Coldline. In improver, the data location tin be specified, which as well impacts the availability, by choosing between region, dual-region and multi-region. Google Cloud Storage comes with built-in capabilities to manage and automate bucket lifecycle rules. Using cloud computing resources has never been easier. The number of tools and overall methods one has at their disposal to interact with these resource is useful to a range of different users. In Google Deject Platform, there are three unlike methods that tin exist used: What would y'all use if you had multiple files to store in object storage in the deject? The gsutil command-line tool of course! Now let'due south encounter how to do it. In this section nosotros are going to explore how the gsutil command-line tool works in practise. This tool can help with the transfer of several objects, including folders, and is too well suited for automating tasks that are not so like shooting fish in a barrel to achieve via the Google Cloud Console. 1. Start by logging in to the Google Cloud Console (the web user interface) and create a new Google Cloud Platform projection with billing configured and enabled. 2. Download and install the latest version of Google Cloud SDK from the official documentation website. Depending on your automobile operating system, the installation process may vary slightly, just in general should be quite straightforward. iii. You lot tin verify that the install went successfully by opening upwardly your machine concluding and executing the command gsutil -five. You volition be greeted with the version of the gsutil installed on your machine (Fig. ane). If non, please make certain to go back to steps 1 and 2 before proceeding further. Fig.1 gsutil version. 4. To start using gsutil, you first need to authenticate it with your Google Deject Platform business relationship. Issue the command gcloud auth login and yous will be directed to your browser to authenticate. Once the process is successful, both your email and active GCP projection will be displayed in the terminal (Fig. 2). Fig.two Cosign to GCP using gcloud. Creating a Google Cloud Storage bucket is the first footstep before any files (i.east. objects) can be uploaded to Google Deject Storage. The saucepan is a virtual namespace for our objects and, as you lot might retrieve, an object tin only belong to a single bucket. one. Using your automobile concluding, issue the command gsutil help mb (Fig. 2.). This help command will provide you all the syntax details of the mb (make bucket) choice. Y'all can use the aid control with any of the gsutil options, which is an invaluable resource for providing information and detailed explanations on all the mandatory and optional flags. Fig.3 gsutil help pages 2. Creating the Google Cloud Storage bucket is, equally you might have noticed from the previous output (Fig. 3 to a higher place), quite simple. Utilize the control gsutil mb gs://<YOUR_BUCKET_NAME> to create it (Fig. four). Y'all will need to make certain that <YOUR_BUCKET_NAME> is a unique name, not only in your GCP account but in the unabridged global Google Cloud Platform. Fig.four Create a GCP Bucket using gsutil The process of adding and removing information from a Google storage bucket is quite elementary and fast, with the just potential bottleneck being the speed of your internet connection. If you lot are used to the terminal, you may exist familiar with the concept of the commands cp (copy) and rm (remove). The Google Cloud Storage command-line tool gsutil uses the exact same concept. 1. First past changing the directory to the folder in your local car where the files y'all desire to upload are located. In our example case, this would be a binder in our Desktop called "photos" (Fig. 5). 2. In order to copy all the files in the current directory to the storage bucket we previously created, we will use the command gsutil cp * gs://<YOUR_BUCKET_NAME> (Fig. 5). One of import aspect to note is that when performing an upload of multiple large files, using the flag -grand, to perform a parallel (multi-threaded/multi-processing) copy, volition significantly improve the operation. Also, if you lot wish to include local subfolders in your upload, y'all will exist required to use the flag -r, i.e., to perform a recursive re-create. 3. You lot tin verify the files were properly created past using the command gsutil ls gs://<YOUR_BUCKET_NAME> and list the contents of the bucket (Fig. v). Fig.5 Copying multiple files using gsutil 4. Likewise, if yous wish to remove the objects from the storage bucket, you can issue the command gsutil rm gs://<YOUR_BUCKET_NAME>/* to remove all the files inside the bucket (Fig. vi). 5. Clean up the environment by deleting the Deject Storage saucepan you created, past using the subcommand rb (remove bucket), i.e., with the control gsutil rb gs://<YOUR_BUCKET_NAME> (Fig. 6). Fig.vi Removing files and bucket using gsutil You've just seen how to interact with the Google Deject Platform's console, command-line tools, and SDK's. At present that you know how to install and authenticate with Google Cloud using your machine terminal, there'due south a lot more on Google Cloud and Google Deject Storage with Cloud Volumes ONTAP. Follow the links below to learn how to:
What Is Object Storage?
Unlike Means to Collaborate with Google Cloud Platform
How to Use the gsutil Control-Line Tool
How to Prepare a Workspace with Google Cloud Tools
Creating a Google Deject Storage Bucket with gsutil
Calculation/Removing Information from a Google Storage Saucepan with gsutil
Read More on How to Use Google Cloud
Source: https://cloud.netapp.com/blog/gsutil-command-line-control-of-google-cloud-storage
0 Response to "Upload Local Files to Google Cloud Shell"
Post a Comment