The cloud computing space is evolving. Every day new offerings from cloud vendors like Google, AWS, and Azure are launched. In the last few years, the offerings have become more mature and stable and are seeing rapid adoption in the enterprise world. Developers are moving from on-premises solutions to adopting the service offerings from cloud providers.
Many of you may be running workloads on the cloud and are aware of the benefits that you are deriving. Let’s reiterate these benefits:
Pay per use: This is efficient and cost effective. You pay for the exact amount of resources you consume.
Zero maintenance headaches: Operating in the cloud also means no worries about physical hardware infrastructure provisioning, upgrades, or maintenance. The cloud provider takes the responsibility of upgrading and maintaining everything, allowing you to focus on application development.
Easy scalability: Providers offer auto-scaling capabilities as your computing needs peek, freeing you from worries about workloads peaks and troughs.
Fully accessible: Enables you to work from anywhere at any time and from any device.
Quick deployment: Speeds up application development as provisioning with the cloud is just a matter of a few hours, whereas the traditional mode of setting up the infrastructure takes months.
Multiple cloud vendors are competing for the mindshare of the users, and these cloud providers each have their own strengths and capabilities.
The Google Cloud Platform (GCP) is a portfolio of cloud computing services offered by Google. Their services are well positioned for the modern application development user. GCP has some unique offerings in the Big Data analytics, artificial intelligence, and containerization spaces.
Google’s first foray into cloud computing was with Google App Engine, which was launched in April 2008 as a Platform as a Service (PaaS) offering. It enabled developers to build and host apps on Google’s infrastructure. In September 2011, App Engine came out of preview, and in 2013 the Google Cloud Platform name was formally adopted. The company subsequently released a variety of tools, such as its data storage layer, Cloud SQL, BigQuery, Compute Engine, and the rest of the tools that make up today’s Google Cloud Platform.
Figure 1-1 shows that, like any cloud provider, Google offers core IaaS (infrastructure as a Service) services for the compute, storage, networking, security, and databases spaces.
Apart from the core services, Google offers PaaS (Platform as a Service) services as well, such as Pub/Sub, DataFlow, AI Hub, and machine learning, to name a few. These PaaS services are built on top of the core stack of services. Google is constantly innovating to strengthen its base further and continues to add to these PaaS services.
This book focuses on the database service offerings in the relational space. Cloud databases are indisputably the future of enterprise databases. Database as a Service (DBaaS) solves the challenges inherent to the traditional on-premises model.
Google is one vendor that is leveraging its strengths in data processing and is establishing its dominance in the Big Data segment. Google’s DBaaS services were born out of their internal database management models. It brings in differentiated products to this category. In addition, as compared to the other vendors, Google DBaaS users get to achieve high levels of customization, which are covered in the coming chapters.
Despite being a late entrant in the cloud domain, Google has quickly risen to deliver the best performance for the price in the DBaaS segment.
Before you start using any of the GCP services, you need to know how to get started with GCP. Let’s begin exploring the platform. This chapter walks through the Google Cloud Platform.
Signing Up
It’s time to get started with GCP. The first step is to sign up for GCP. The following steps are required for signing up and are more relevant to first time users.
The primary prerequisite for signing up is a Google account. GCP uses Google accounts for access management and authentication. As shown in Figure 1-2, you enter the https://console.cloud.google.com URL in your browser window and click the Try For Free button.
You will be redirected to the Sign In page, as shown in Figure 1-3.
This prompts you for a Google account. If you don’t have a Google account, follow the Create Account process to create one. If you are eligible for the free tier, you will be prompted for the account details, as shown in Figure 1-4.
Select your country, agree to the terms of service, and click the Agree and Continue button. This will take you to the second step, as shown in Figure 1-5, wherein you create and select your payment profile. Provide the required billing details; however, rest assured that the auto debit will not happen unless you manually choose that option.
While you create your payment profile and sign in, the right panel displays details, as shown in Figure 1-6.
As you can see, Google gives a free trial of $300 to everyone to be spent over a period of 12 months. This is sufficient not only to explore all the exercises in this book but also to evaluate GCP further.
Once you have specified all the details, click on the Start My Free Trial button.
It will take a while for the registration to be completed. Once the necessary validations are done, you will be redirected to the Google Console and are ready to get started.
Note
If you are already signed into an account, you will be directly sent to the GCP Cloud Console.
Accessing Google Cloud Platform
Now that you have signed up, you can next look at accessing the GCP services and resources using a web-based graphical user interface (a Cloud Console) and a command line (a Cloud Shell).
Cloud Console
Navigate to https://console.cloud.google.com. If you’re not already signed in, it will prompt you to enter the Google account credentials. Once you’re signed in, it will redirect you to the Cloud Console, as shown in Figure 1-7.
In the top-most panel, next to the GCP icon, a dropdown appears with My First Project selected. This is the project dropdown, and My First Project is a new project that’s automatically created when you first sign in.
A project can be thought of as a container for your work, wherein all the resources are isolated from the resources created in other projects. You will learn about projects and how you create a project in a while.
The center of the console is a dashboard that gives you a bird’s eye view of the selected project. The view is further divided into multiple cards wherein each card refers to specific information.
The Project Info card shown in Figure 1-8 gives details about the project, such as the names and IDs, along with a quick link at the bottom enabling easy modification of the project settings.
The Google Cloud Platform status card, as shown in Figure 1-9, gives you a quick status check. Green indicates that everything is working fine.
The billing card shows the billing details at a glance for the selected project, as shown in Figure 1-10.
There is also a card for Quick Starts, as shown in Figure 1-11, which you could use when exploring GCP services and offerings.
On the left side of the top-most panel is the navigation button, as shown in Figure 1-12. Clicking this button opens the navigation menu where all the GCP offerings are categorized and listed.
You will come back and explore the menu when subsequent chapters cover the relevant areas. Feel free to familiarize yourself by exploring this console.
Cloud Shell
Now that you have familiarized yourself with the web console, next you learn how to manage the resources using commands and scripts.
The GCP Cloud Shell option enables you to access and manage its resources directly from the command line. Click on the Activate Cloud Shell button in the top-right corner of the Cloud Console, as shown in Figure 1-13, to access the Cloud Shell.
Click on Start Cloud Shell to get started. The Cloud Shell session opens inside a new frame at the bottom of the console, as shown in Figure 1-15.
It takes a few seconds to initialize the Cloud Shell session as Google spins up an active instance for this. This instance runs on the Google Cloud and provides a complete environment to connect to the various resources in the cloud.
The Cloud Shell instances are provisioned on a per user and per session basis. The instances persist while the session is active and are terminated after an hour of inactivity.
After the initialization, a command prompt is displayed for you, as shown in Figure 1-16. You can start keying in your commands.
You can start multiple sessions to the same instance by clicking on the + icon, as shown in Figure 1-17.
This opens a new tab to the same instance, as shown in Figure 1-18.
The Cloud Shell automatically authenticates the logged-in account ID and picks the active/selected project as the current default. This can be seen on the command prompt. Figure 1-19 shows that the project ID is displayed on the command prompt.
With Cloud Shell, the Cloud SDK gcloud command and other utilities are available. They enable you to work with the resources and perform a whole bunch of operations. There’s no need to install or set up anything.
Let’s start keying in a few commands using gcloud. You will start by validating the current default project set (see Listing 1-1). Enter the gcloud config list project command.
Welcome to Cloud Shell! Type "help" to get started.
Your Cloud Platform project in this session is set to igneous-future-248210.
Use "gcloud config set project [PROJECT_ID]" to change to a different project.
architectbigdata@cloudshell:~ (igneous-future-248210)$ gcloud config list project
This displays the selected project. Next, you validate which active account is authenticated to work with the selected project by using the gcloud auth list command (see Listing 1-2).
architectbigdata@cloudshell:~ (igneous-future-248210)$ gcloud auth list
You can see that the logged-in account is being set as the active account. The Cloud Shell is a full-fledged command line on the browser, so you can run Linux commands.
You can change the active account as well as the current default project set using gcloud commands. Type gcloud –h to get help on what commands are available with gcloud (see Listing 1-3).
--trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for
details.
GROUPS
GROUP is one of the following:
configurations
:
Listing 1-5
Config Help Output
Note
Press Enter to navigate through the output. Once you’re done, press q to return back to the shell.
Now that you know that the config command helps you manage properties, you can use gcloud config list to view which properties are set in the configuration for this instance. See Listing 1-6.
architectbigdata@cloudshell:~ (igneous-future-248210)$ gcloud config list
It displays only the properties that have changed and are different from the default settings. For example, you can see the account is set to the Gmail ID and the project is set to the selected project. You can use gcloud config list –all to view all the properties that can be managed using this command.
It lists all the properties with a few marked as unset. These are the ones that are either default or are not yet set. See Listing 1-7.
architectbigdata@cloudshell:~ (igneous-future-248210)$ gcloud config list --all
You saw how easy it is to work with the Cloud Shell. It’s an easy way to get up and running with the Google Cloud. The book uses the Console as it walks through the topics. Feel free to explore the other commands.
gcloud, the powerful and unified command-line tool for the Google Cloud Platform, is especially useful when you want to script operations that need to be performed on a regular, routine basis. Rather than running the steps manually, you can run the script and free up the manual resources from mundane tasks.
Cloud SDK
The Cloud Shell option is typically used when you can’t download the software on your local machine. However, since the VM instances are spun up temporarily, it’s not a very good option when you have to do development intensively using Google Cloud.
In that case, downloading and using Google Cloud SDK is the better option. Google provides command-line tools and APIs to interact with its services and resources via Google Cloud SDK.
The book will return to its usage when you start working with the services offered by GCP in the coming chapters. Before you go any further, it’s important to briefly understand what a project is and how you create a new one.
Project
When you first signed up for GCP, you learned that GCP automatically creates a new project named My First Project, which is basically used to isolate the resources of the project from the resources of other projects.
A project is the base organizing entity; primarily a container for all the resources you create. It’s a must to get started with GCP. For example, if you create a new instance, it will be owned by a project. Further, any charges incurred by the resources will be charged to its project.
Ownership: Projects and Billing
The project is the top-level billing instance, which implies that billing in GCP happens at the project level and not at the account level.
The billing account that you created at the start is by default associated with the project; however, different billing accounts can be specified for each project you create. That way, if you have a bunch of Google Cloud projects going on in the same organization, you can ask different departments or different teams within a department to pay for it.
So, you can have multiple projects associated with a single billing account or you can have multiple billing accounts, each associated with different projects. You use the billing menu to manage project-wise billing accounts. Figure 1-20 displays the default billing account overview and the projects linked to the account.
Figure 1-21 shows the context menu associated with the accounts. Clicking on the context menu enables you to disable the billing account for the project or change the billing account. If no action is taken, the projects billing continues to happen through this account only.
The billing of a project happens based on the services used within.
Projects and Isolations
Not only does the project own a resource, but it is also used to isolate the resources from one another. This means that if users have access to view a project, they will have access to all its resources but will not be able to view resources in other projects unless specified. This is very useful in controlling who views what.
Project as Namespace
A project also serves as a namespace, which means every resource in a project must have a unique name. As an example, consider the actual environment depicted in Figure 1-22.
There are various departments and development teams. Teams work on various products. Each product has a Dev environment, a Test environment, and a Production environment.
In GCP, each environment should be represented as a project, which is an organizing unit of all resources required to achieve a precise objective. So in GCP, the environment from Figure 1-22 will look like Figure 1-23.
You need to create multiple projects, each pertaining to a specific need or requirement.
In addition, say you have customer-specific implementations. You can then have customer specific projects, wherein resources and changes within a project are visible only to that customer’s users and not to others.
Create a Project
Now that you’re familiar with what a project is, it’s time to create a project. Click on the Projects dropdown appearing in the top-most panel, as shown in Figure 1-24.
Figure 1-25 shows the pop up that will appear with all projects listed under Recent. In this case, the default created project is visible.
Click on New Project. A window will appear, as shown in Figure 1-26.
Note
If you are using the trial quota, you’ll have a limit of 23 projects. This is sufficient for the examples in the book.
All projects consist of the following:
Project Name: A display name that’s mutable and is provided while creating.
Project ID: This comes prepopulated but you can change it. The ID is unique across GCP. Once the project is created, it cannot be changed. The ID cannot be used again, even if you delete the project.
Project Number: Provided by GCP. It is automatically assigned when the project is created and is read-only.
To follow along with the example here, try creating a project named ExampleGettingStarted. Figure 1-27 shows the pop up with the name specified.
Click on Create to create the project. Once you have created the project, it will start appearing in the project dropdown, as shown in Figure 1-28. Click on the dropdown and select the project.
You will be redirected to the Cloud Console with the selected project set as active, as shown in Figure 1-29.
In order to interact with most GCP resources, you must provide the identifying project information for every request. This is either a project ID or a project number.
Summary
This chapter covered the basics of getting started with GCP. The next chapter will start with Cloud SQL.