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:

  • Object storage introduction
  • Come across the Google Panel, SDK, and Control-line tool
  • How to use the gsutil control-line tool
  • Detect more Google Cloud articles

What Is Object Storage?

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.

Unlike Means to Collaborate with Google Cloud Platform

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:

  • Google Deject Console: Using the Console, or Spider web User Interface, is the most typical choice while interacting with Google Cloud. It lowers the barrier to entry-level users to start using GCP, and at the same time it provides a rich set of features and intuitive interface. However, it is worth noting that not all the features are available in the Console—users may often need to utilise either the SDK or command-line tool to perform certain deportment.
  • SDK: An SDK, or Software Development Kit, is oft the preferred way of applications to interact with Google Cloud. Google Deject has SDK's available for multiple programming languages including Become, Python, and node.js.
  • Command-Line Tool: While, in theory, Google Cloud's control-line tools are part of the SDK, they are often referred to separately. Google Cloud Platform has i control-line tool gcloud that tin can exist used to interact with any GCP service. In addition to that, Google Cloud Storage itself has also a control-line tool of its own: gsutil. This tool enables the customer to interact with GCP using all the available features at their disposal.

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.

How to Use the gsutil Control-Line Tool

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.

How to Prepare a Workspace with Google Cloud Tools

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.

Gsutil version 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).

Authenticate to GCP using gcloud Fig.two Cosign to GCP using gcloud.

Creating a Google Deject Storage Bucket with gsutil

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.

Gsutil help pages 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.

Create a GCP Bucket using gsutil Fig.four Create a GCP Bucket using gsutil

Calculation/Removing Information from a Google Storage Saucepan with 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).

Copying multiple files using gsutil 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).

Removing files and bucket using gsutil Fig.vi Removing files and bucket using gsutil

Read More on How to Use Google Cloud

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:

  • Migrate data to Google Cloud fast and efficiently
  • Enhance your disaster recovery and data protection in Google Cloud
  • SQL Server on Google Cloud: Managed Service Vs. Managed Storage
  • Enterprise Workloads with Deject Volumes ONTAP on Google Deject
  • File Sharing in the Cloud on GCP with Deject Volumes ONTAP
  • Google Cloud Example Studies with NetApp Cloud Volumes ONTAP

New call-to-action

phillipslative.blogspot.com

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

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel