- Google Cloud Platform for Architects
- Vitthal Srinivasan Janani Ravi Judy Raj
- 631字
- 2021-06-25 20:48:27
Using the Cloud Shell
Before we jump into the compute options on GCP and create our first VM instance, let's understand the Cloud Shell. A Cloud Shell is a machine instance that runs on the Google Cloud which serves as your command line. All GCP accounts have a Cloud Shell that they can use to access resources on the Google Cloud Platform. You can access the Cloud Shell by clicking on a button to the top right of the navigation ribbon:

The great thing about the Cloud Shell is that it provides a complete environment for you to connect to various resources in the Cloud. Also, it is worth noting that the Cloud Shell is completely free for usage. The cool thing about it is that you can directly use the gcloud command-line tools to connect to resources in the cloud, create resources, provision it, and so on. You don't need to install and set up anything. The Cloud Shell is what you would use if, say, your organization does not allow you to download software on your local machine. It is a great alternative in that case, which just works. When you first connect to the Cloud Shell or gshell, Google has to spin up an active instance to use for this. It might take a little while, so be patient:

The figure that follows is our provisioned Cloud Shell and you will notice that it is associated with the same project which we mentioned earlier. Let's take the gcloud command-line tool for a test run. Remember that the Cloud Shell is just a terminal session on an ephemeral VM. This session will get disconnected after 30 minutes of inactivity. Also, when you are in the Cloud Shell, you are in a home directory with 5 GB of space, and this home directory will remain constant across all Cloud Shell sessions in the project and will be deleted after 120 days of inactivity:

Let’s explore the Cloud Shell further. The gcloud is Google's main command-line tool that allows you to work with resources and to a whole bunch of operations. It's especially useful if you want to script operations and just run a script rather than perform it manually over and over again.
You can view what the current default project is by typing out the gcloud config list command:

You can see that loonycorn-project08 is the default. If you need help with what commands are available with gcloud, simply type gcloud -h, and you will see a whole bunch of information. The gcloud config list command shows you what properties have been set so far in the configuration. This will only display those properties that are different from the defaults. For example, you can see here that the account has been set to vitthal@loonycorn.com and the project is loonycorn-project08:

If you need help for a particular command, let's say it's the compute command, you can simply say gcloud compute --help:

This essentially throws up the main page for that particular command. In other words, gcloud has context-sensitive help, and that is a great way to go about building the commands you need:

Everything you need is right there on the screen.
In a nutshell, the Google Cloud Shell is a great tool for quick work on the console. Remember, again, though, that it is a short, time-limited session on an ephemeral VM. So, if you are going to be intensely developing on the Google Cloud and you can download software, it's better to download the Google Cloud SDK and use that instead. This offers a permanent connection to your instances on the cloud instead of a temporary VM instance that has to be spun up in order to use Cloud Shell.
- Python數據分析與挖掘實戰
- Google Visualization API Essentials
- 劍破冰山:Oracle開發藝術
- Modern Programming: Object Oriented Programming and Best Practices
- 文本挖掘:基于R語言的整潔工具
- R數據科學實戰:工具詳解與案例分析(鮮讀版)
- 數據驅動:從方法到實踐
- Spark核心技術與高級應用
- 大數據營銷:如何讓營銷更具吸引力
- MySQL 8.x從入門到精通(視頻教學版)
- 辦公應用與計算思維案例教程
- Google Cloud Platform for Developers
- R Object-oriented Programming
- 數據庫查詢優化器的藝術:原理解析與SQL性能優化
- MySQL核心技術手冊