Get startedGet started for free

Demo: Projects

1. Demo: Projects

Let's explore projects which are the key organizer of infrastructure resources and relate these resources to billing accounts. Resources can only be created and consumed within projects in a way that projects isolate related resources from one another. I will demonstrate how to create and delete projects, and switch contexts between projects. Some of these actions cannot be performed in the Qwiklabs environment due to security restrictions. Therefore, I'm going to demonstrate them in my environment. So here I am in the GCP console. You can actually see this is a trial account and you can also create a trial account yourself if you would like to follow along with this. Essentially, what I'm going to do first is go ahead and create a project. So I'm going to click up on my product name up here, and there's this icon up here to create a new project, so let me go click that. Now, the one thing I want to do is, I want to define a project name. So let me just say my new project. You can see that it automatically creates the project ID and project ID is going to be unique versus my name is really not so unique. So let me click "Create" on that. It is now telling me here that is going to create that project. I can follow along with that here in the notification pane. One thing to notice is, when you create a new project, that some of the services that you're going to use may not be initially available. So here, I now have my new project. I could now switch projects. So if I go to my home, for example, I see here the project itself, I could go to the project settings, I could shut that down, or I could switch to a different one. So let me actually change up here to this new project that I created. You go in there and let's follow the process for shutting that down. So I'm going to click on "Shutdown", I wants to make sure that I really want to do that. It's telling me a little bit about what's going to happen when I do this. Specifically, all building in traffic serving will stop, but the shutdown is actually scheduled. So it will take 30 days, and this is in case that you want up maybe undo this. So I need to just retype my project ID, and I can actually copy and paste it in here, and I can click ''Shutdown'', and it should now give me a notification. So here it's telling me when exactly it's going to shut this down, and I can click ''OK'' on that. So now, this is being scheduled for shutdown. So now, I can go back and obviously want to grab in project, it's automatically put me in the sight. Alternatively, if I go home, you'll see that I also have an option up here. It's telling me, hey, you really need to select a project. So lots of different ways to go about. So I could click on that and select a project. Now, I want to show in a second how we can also move switched projects on screen Cloud Shell. So let's actually go ahead and create another project. Let's just call this My Second Project. We can create that as well. They'll start in the background for us. So what I want to do now, as I said I want to go to Cloud Shell. So if I go up here on the right corner, it's Activate Cloud Shell. I'll just click on that. It doesn't ask me if you want to start Cloud Shell because I've already been using Cloud Shell with this user. So it's also telling me that I haven't used my Cloud Shell in awhile, so it has to unarchive my disk and that's going to take a little bit of time. But once that's up, we can actually go use gcloud config list command and we can paste it in, and it's going to give us more information about the configuration that we currently have. That will include the project that we currently have selected. We can actually see the project right here. This is the project I'm working on right now. So if I paste in, I automatically copy that when I clicked on it. So I want to instead type in here gcloud config list. So here, we get some more information. I can also use the grep command in here to directly got my project and there we see this is the project that we're currently using. I could actually now even changed the focus of my GCP console to this new project. You'll see if I run this command again, my focus of Cloud Shell is still focused on this other project that I had. So one thing we could do now, is we could store the project ID maybe in an environment variable and then we could maybe set it so we could swap back and forth. So let me get the project ID, it's right here. I'm going to maybe just store that in an environment variable. Let's just call that my project ID1. So let me grab the project ID, copy that, paste it in there. So now, I have that stored and now I could use the gcloud config set project to define an action to change the project ID. Now, you can see that I have that other project ID listed here. So I can actually see that, and I could also now use it the same gcloud config list command and grep the project, and you'll see that now I'm working with different project. That's how easy it is to create and delete projects, and switch contexts between projects.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.