arrow_back

Create and Manage AlloyDB Instances: Challenge Lab

로그인 가입
700개 이상의 실습 및 과정 이용하기

Create and Manage AlloyDB Instances: Challenge Lab

실습 1시간 30분 universal_currency_alt 크레딧 1개 show_chart 입문
info 이 실습에는 학습을 지원하는 AI 도구가 통합되어 있을 수 있습니다.
700개 이상의 실습 및 과정 이용하기

GSP395

Google Cloud self-paced labs logo

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 are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials 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).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

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

  1. Your first task is to create a cluster.

  2. 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.

  3. 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



Note: The private services access connection option was configured for this project when you started the lab. This step was required to allow access to the AlloyDB cluster.

If you are using the gcloud CLI, an example command to create a cluster is as follows.

Note: You must substitute the required values or your configuration will be invalid and you will not pass this challenge lab. gcloud beta alloydb clusters create SAMPLE-CLUSTER-ID \ --password=SAMPLE_PASSWORD \ --network=SAMPLE_NETWORK \ --region=GCP_REGION_VALUE \ --project=QWIKLABS_PROJECT_ID
  1. 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.

Note: You must substitute the required values or your configuration will be invalid and you will not pass this challenge lab. gcloud beta alloydb instances create SAMPLE-INSTANCE-ID \ --instance-type=PRIMARY \ --cpu-count=2 \ --region=GCP_REGION_VALUE \ --cluster=SAMPLE-CLUSTER-ID \ --project=QWIKLABS_PROJECT_ID
  1. 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.

  2. Click Check my progress to verify the objective.

Create a cluster and instance

Task 2. Create tables in your instance

  1. 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.

  2. On the Navigation menu (Navigation menu icon), under Compute Engine click VM instances.

  3. For the instance named alloydb-client, in the Connect column, click SSH to open a terminal window.

  4. Set the following environment variable, replacing ALLOYDB_ADDRESS with the Private IP address of the AlloyDB instance from the previous task.

export ALLOYDB=ALLOYDB_ADDRESS
  1. 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.
echo $ALLOYDB > alloydbip.txt
  1. 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.
psql -h $ALLOYDB -U postgres
  1. Your database must have a total of three (3) tables - regions, countries, and departments.

  2. The tables must be defined as listed below.

An example DDL command to create an AlloyDB table is as follows:

CREATE TABLE sample ( sample_id bigint NOT NULL, sample_name varchar(25) ) ; ALTER TABLE sample ADD PRIMARY KEY (sample_id);

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

  1. Next load the tables you just created with the following simple, low-volume datasets.

  2. 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.

Note: The data elements provided are written in the order of the columns of the corresponding table.

An example DML command to load a single row into an AlloyDB table is as follows.

INSERT INTO Sample VALUES (1, 'Sample Value');



Table: regions

1, 'Europe' 2, 'Americas' 3, 'Asia' 4, 'Middle East and Africa'

Table: countries

'IT', 'Italy', 1 'JP', 'Japan', 3 'US', 'United States of America', 2 'CA', 'Canada', 2 'CN', 'China', 3 'IN', 'India', 3 'AU', 'Australia', 3 'ZW', 'Zimbabwe', 4 'SG', 'Singapore', 3

Table: departments

10, 'Administration', 200, 1700 20, 'Marketing', 201, 1800 30, 'Purchasing', 114, 1700 40, 'Human Resources', 203, 2400 50, 'Shipping', 121, 1500 60, 'IT', 103, 1400
  1. Click each Check my progress to verify the objectives.
Create and Load Tables

Task 4. Create a Read Pool instance

  1. 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.

  2. 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.

Note: You must substitute the required values or your configuration will be invalid and you will not pass this challenge lab. gcloud beta alloydb instances create SAMPLE-READ-POOL-INSTANCE-ID \ --instance-type=READ_POOL \ --cpu-count=2 \ --read-pool-node-count=2 \ --region=GCP_REGION_VALUE \ --cluster=SAMPLE-CLUSTER-ID \ --project=QWIKLABS_PROJECT_ID
  1. Click Check my progress to verify the objective.
Create a read pool instance

Task 5. Create a backup

  1. 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.

  2. On the Cloud Console Navigation menu (console_nav_small.png), under Databases click AlloyDB for PostgreSQL then Backups to launch the Backups page.

  3. Your backup must be named lab-backup.

If you are using the gcloud CLI, an example command to create a backup is as follows.

Note: You must substitute the required values or your configuration will be invalid and you will not pass this challenge lab. gcloud beta alloydb backups create SAMPLE-BACKUP_ID \ --cluster=SAMPLE-CLUSTER-ID \ --region=GCP_REGION_VALUE \ --project=QWIKLABS_PROJECT_ID
  1. Click Check my progress to verify the objective.
Create a backup

Congratulations!

In this challenge lab, you created a Cloud Spanner instance and database, created tables, loaded data, and performed DDL operations on a table.

Create and Manage AlloyDB Databases skill badge

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 2025 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.

시작하기 전에

  1. 실습에서는 정해진 기간 동안 Google Cloud 프로젝트와 리소스를 만듭니다.
  2. 실습에는 시간 제한이 있으며 일시중지 기능이 없습니다. 실습을 종료하면 처음부터 다시 시작해야 합니다.
  3. 화면 왼쪽 상단에서 실습 시작을 클릭하여 시작합니다.

시크릿 브라우징 사용

  1. 실습에 입력한 사용자 이름비밀번호를 복사합니다.
  2. 비공개 모드에서 콘솔 열기를 클릭합니다.

콘솔에 로그인

    실습 사용자 인증 정보를 사용하여
  1. 로그인합니다. 다른 사용자 인증 정보를 사용하면 오류가 발생하거나 요금이 부과될 수 있습니다.
  2. 약관에 동의하고 리소스 복구 페이지를 건너뜁니다.
  3. 실습을 완료했거나 다시 시작하려고 하는 경우가 아니면 실습 종료를 클릭하지 마세요. 이 버튼을 클릭하면 작업 내용이 지워지고 프로젝트가 삭제됩니다.

현재 이 콘텐츠를 이용할 수 없습니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

감사합니다

이용할 수 있게 되면 이메일로 알려드리겠습니다.

한 번에 실습 1개만 가능

모든 기존 실습을 종료하고 이 실습을 시작할지 확인하세요.

시크릿 브라우징을 사용하여 실습 실행하기

이 실습을 실행하려면 시크릿 모드 또는 시크릿 브라우저 창을 사용하세요. 개인 계정과 학생 계정 간의 충돌로 개인 계정에 추가 요금이 발생하는 일을 방지해 줍니다.