The course is part of these learning pathsSee 6 more
Google Cloud Platform (GCP) is a collection of online services that organizations can use to build, host, and deliver applications. The best part is that GCP runs in Google’s data centers, so you can take advantage of Google’s global network and vast experience with serving applications to billions of people around the world.
In this course, you will get an overview of the GCP services available in various categories, such as compute, storage, and networking, and you will also see hands-on examples showing you how to create virtual machines and web apps using the Google Cloud Console and gcloud command-line interface.
- Describe some of the GCP services available in various categories
- Use the Google Cloud Console
- Use the gcloud command-line interface
- Anyone who would like to learn more about Google Cloud Platform
- General technical knowledge
- A Google Cloud Platform account is recommended (sign up for a free trial at https://cloud.google.com/free/ if you don’t have an account)
The GitHub repository for this course is at https://github.com/cloudacademy/gcp-overview.
As you saw in the last demo, it’s pretty easy to use the portal to create GCP resources. But if you know how to use the command-line interface, you can usually create resources more quickly, often with a single command. For example, to create a virtual machine called instance-1 in the us-central1-a zone, all you need to do is type, “
gcloud compute instances create instance-1 --zone=us-central1-a”. This will create the instance using defaults for everything. To specify particular options, you can just add them to the command.
But to give you some variety, in this demo, I’m going to show you how to create a website on App Engine using the command line. And we’re going to do it without installing the Google Cloud SDK on your desktop.
If you click on this icon, it’ll start the Cloud Shell, which is a very small virtual machine that you can use to run commands. It already has the Cloud SDK installed on it, so we don’t need to. To make it bigger, click here. This brings it up in its own browser tab.
For our website, we’re going to use a very simple example Google has created called the Hello World app. First, we need to download it. The command to do that is in the readme file in the GitHub repository for this course. The link to the repository is at the bottom of the Overview tab below this video.
Here’s the command. Copy it and paste it at the Cloud Shell prompt.
Okay, it’s done downloading, so now we need to go into the directory that has the Hello World app in it. Let’s see what’s in this directory. This is a Python app, so the main file here is called main.py. The rest of the files are basically just supporting files.
Now we can deploy this web application to App Engine using a single command. First, we type “
gcloud”, which is the command-line tool used for most of GCP’s services. Then we type “
app”, which means that we’re going to do something with App Engine. Then we type “
deploy”, which means to deploy the files in the current directory to App Engine.
Now we have to authorize Cloud Shell to make a GCP API call. Just click the Authorize button. Since this is the first time deploying to App Engine in this project, it needs to create an application. We have to choose a region where the application will be deployed. We won’t be able to change it to another region later, so we have to be sure to pick the right one. I’m going to choose “us-central” again.
It gives the details of what it’s going to create, and it asks for confirmation. You can just hit Enter because the default choice is ‘Y’. You can tell it’s the default because it’s capitalized. This’ll take a while, so I’ll fast-forward.
Okay, it’s done. Now to see if it worked, copy this URL, and paste it into a browser tab. It worked. It says, “Hello World!”, which is all it’s supposed to do. That was pretty easy, wasn’t it?
If you’re following along on your own account, you may want to delete your App Engine instance to avoid incurring additional charges. However, because we went with the default Standard environment, App Engine will not run any VMs to serve this website unless it receives more requests. So, you shouldn’t incur any charges unless someone accesses your app’s URL for some reason.
Nevertheless, you may want to disable it, just in case. Surprisingly, there’s currently no way to do this from the command line. The only way to do it is to go to App Engine in the console. Looks like I need to refresh this. And I need to go through a few getting started things here.
Okay. Now select Settings, and click the “Disable application” button.
And that’s it for this quick introduction to the command-line interface.
Guy launched his first training website in 1995 and he's been helping people learn IT technologies ever since. He has been a sysadmin, instructor, sales engineer, IT manager, and entrepreneur. In his most recent venture, he founded and led a cloud-based training infrastructure company that provided virtual labs for some of the largest software vendors in the world. Guy’s passion is making complex technology easy to understand. His activities outside of work have included riding an elephant and skydiving (although not at the same time).