Checkpoints
Create a cluster and instance
/ 25
Create and Load Tables
/ 25
Create a read pool instance
/ 25
Create a backup
/ 25
Create and Manage AlloyDB Instances: Challenge Lab
GSP395
Overview
In a challenge lab, you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
This lab is recommended for students who have enrolled in the Create and Manage AlloyDB Instances skill badge. Are you ready for the challenge?
Topics tested
In this challenge lab, you are required to perform the following tasks:
- Create a cluster and instance
- Create tables in your instance
- Load simple datasets into tables
- Create a Read Pool instance
- Create a backup
Target Audience
The content of this challenge lab will be most applicable to AlloyDB for PostgreSQL DBAs. This lab is designed to test the abilities of students who have completed the Create and Manage AlloyDB Databases quest.
Setup and Requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
Challenge scenario
In your role as the corporate Database Administrator, you have been tasked with standing up a new AlloyDB for PostgreSQL database for your company's HR Operations group. You have been provided a list specifcations for this database related to tables to create and data to load.
Task 1. Create a cluster and instance
-
Your first task is to create a cluster.
-
You may complete this step using the Cloud Console or the gcloud CLI. If you use the glcoud CLI you must refer to and use the GCP Region value that is provided on your lab launch page.
-
Your cluster must have following attributes. You can keep the default values for all other settings:
Item | Value |
---|---|
Cluster ID | lab-cluster |
Password | Change3Me |
Network | peering-network |
If you are using the gcloud CLI, an example command to create a cluster is as follows.
- Next you must create an instance. If you following the Cloud Console wizard, your cluster's instance must have following attributes:
Item | Value |
---|---|
Instance ID | lab-instance |
Machine Type | 2 vCPU, 16 GB |
If you are using the gcloud CLI, an example command to create an instance is as follows.
-
When you are on the Overview page for the new cluster you created, please make note of the Private IP address in the instances section. Copy the Private IP address to a text file so that you can paste the value in a later step.
-
Click Check my progress to verify the objective.
Task 2. Create tables in your instance
-
Next you must create tables in your AlloyDB instance. A VM named, alloydb-client, containing the PostgreSQL client was provisioned for you at the start of the lab.
-
On the Navigation menu (), under Compute Engine click VM instances.
-
For the instance named alloydb-client, in the Connect column, click SSH to open a terminal window.
-
Set the following environment variable, replacing ALLOYDB_ADDRESS with the Private IP address of the AlloyDB instance from the previous task.
- Run the following command to store the Private IP address of the AlloyDB instance on the AlloyDB client VM so that it will persist throughout the challenge lab.
- Use the following command to launch the PostgreSQL (psql) client. You will be prompted to provide the postgres user's password (Change3Me) which you entered when you created the cluster.
-
Your database must have a total of three (3) tables - regions, countries, and departments.
-
The tables must be defined as listed below.
An example DDL command to create an AlloyDB table is as follows:
Table: regions
Primary Key: region_id
Column | Datatype |
---|---|
region_id | bigint NOT NULL |
region_name | varchar(25) |
Table: countries
Primary Key: country_id
Column | Datatype |
---|---|
country_id | char(2) NOT NULL |
country_name | varchar(40) |
region_id | bigint |
Table: departments
Primary Key: department_id
Column | Datatype |
---|---|
department_id | smallint NOT NULL |
department_name | varchar(30) |
manager_id | integer |
location_id | smallint |
Task 3. Load simple datasets into tables
-
Next load the tables you just created with the following simple, low-volume datasets.
-
You must use the psql client to load these tables. Use the alloydb-client VM as outlined in the previous task to access the psql client.
An example DML command to load a single row into an AlloyDB table is as follows.
Table: regions
Table: countries
Table: departments
- Click each Check my progress to verify the objectives.
Task 4. Create a Read Pool instance
-
Next create a Read Pool instance for your cluster. You may create the Read Pool instance using the Cloud Console or the gcloud CLI. If you use the glcoud CLI you must refer to and use the GCP Region value that is provided on your lab launch page.
-
Your Read Pool instance must have following attributes. You can keep the default values for all other settings:
Item | Value |
---|---|
Read pool instance ID | lab-instance-rp1 |
Node count | 2 |
Machine Type | 2 vCPU, 16 GB |
If you are using the gcloud CLI, an example command to create a Read Pool instance is as follows.
- Click Check my progress to verify the objective.
Task 5. Create a backup
-
Next create an on-demand backup of your instance. You may create the backup using the Cloud Console or the gcloud CLI. If you use the glcoud CLI you must refer to and use the GCP Region value that is provided on your lab launch page.
-
On the Cloud Console Navigation menu (), under Databases click AlloyDB for PostgreSQL then Backups to launch the Backups page.
-
Your backup must be named lab-backup.
If you are using the gcloud CLI, an example command to create a backup is as follows.
- Click Check my progress to verify the objective.
Congratulations!
In this challenge lab, you created a Cloud Spanner instance and database, created tables, loaded data, and performed DDL operations on a table.
Earn your next skill badge
This self-paced lab is part of the Create and Manage AlloyDB Instances skill badge. Completing this skill badge earns you the badge above to recognize your achievement. Share your badge on your resume and social platforms, and announce your accomplishment using #GoogleCloudBadge.
This skill badge is part of Google Cloud’s Database Engineer learning path. Continue your learning journey by enrolling in the Migrate MySQL Data to Cloud SQL Using Database Migration Service skill badge or the Create and Manage Cloud SQL for PostgreSQL Instances skill badge.
Manual Last Updated May 03, 2024
Lab Last Tested February 26, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.