실습 설정 안내 및 요구사항
계정과 진행 상황을 보호하세요. 이 실습을 실행하려면 항상 시크릿 브라우저 창과 실습 사용자 인증 정보를 사용하세요.

Integrate Private Service Connect with Service Directory

실습 1시간 universal_currency_alt 크레딧 1개 show_chart 입문
info 이 실습에는 학습을 지원하는 AI 도구가 통합되어 있을 수 있습니다.
이 콘텐츠는 아직 휴대기기에 최적화되지 않음
최상의 경험을 위해 데스크톱 컴퓨터에서 이메일로 전송된 링크를 사용하여 방문하세요.

GSP1212

Google Cloud self-paced labs logo

Overview

Private Service Connect

The need for security is important to every organization. Limiting exposure of systems to external networks is a recommended best practice.

Private Service Connect allows private consumption of services across VPC networks that belong to different groups, teams, projects, or organizations. You can publish and consume services using IP addresses that you define and that are internal to your VPC network.

Service Directory

Service Directory (SD) is a managed service that gives you a single place to publish, discover, and connect services. SD integrates with other services like Cloud DNS, Load balancers, Google Kubernetes Engine, Traffic Director and Private Services Connect to name a few.

What you'll build

In this lab, you're going to connect two projects with Private Service Connect to consume a web service in the producer project. This set-up represents a consumer and producer network.

Private Service Connect also automatically allows the option to create a Service Directory namespace for the service which can be used to manage the service endpoint.

lab topology

What you will configure:

  • Create an Internal Application Load Balancer with static IPv4 address to expose the Managed Instance Group in the producer network
  • Publish the service using a Private Service Connect service attachment with unrestricted access in the producer network
  • Create a PSC endpoint and service directory namespace in the consumer project
  • Connect to the web-app from a VM in the consumer project using the PSC endpoint
Note: This lab requires use of two projects that are not connected.

What you'll learn

  • How create Internal Application Load Balancer
  • Publish a service in Private Service Connect
  • Create a Private Service Connect endpoint
  • Create a service directory endpoint
  • Create a private DNS zone for the service directory endpoint
  • Verify service directory endpoint connectivity

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.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details pane.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details pane.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field. Navigation menu icon and Search field

Activate Cloud Shell

Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.

  1. Click Activate Cloud Shell Activate Cloud Shell icon at the top of the Google Cloud console.

  2. Click through the following windows:

    • Continue through the Cloud Shell information window.
    • Authorize Cloud Shell to use your credentials to make Google Cloud API calls.

When you are connected, you are already authenticated, and the project is set to your Project_ID, . The output contains a line that declares the Project_ID for this session:

Your Cloud Platform project in this session is set to {{{project_0.project_id | "PROJECT_ID"}}}

gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.

  1. (Optional) You can list the active account name with this command:
gcloud auth list
  1. Click Authorize.

Output:

ACTIVE: * ACCOUNT: {{{user_0.username | "ACCOUNT"}}} To set the active account, run: $ gcloud config set account `ACCOUNT`
  1. (Optional) You can list the project ID with this command:
gcloud config list project

Output:

[core] project = {{{project_0.project_id | "PROJECT_ID"}}} Note: For full documentation of gcloud, in Google Cloud, refer to the gcloud CLI overview guide.

Task 1. Verify Producer project network configs

What your producer network looks like

The producer network is located in its own project which represents an external producer outside of the consumers control. There is no direct connectivity between producer and consumer.

Currently the producer network contains a managed instance group with servers running an nginx website.

Switch to Producer project

  1. At the left on the lab landing page look for the project identifier.
  2. At the top of your console on the right next to Google Cloud icon, click the dropdown and then select the all tab.
  3. From the listed project select the Producer project
project bar project bar 2

Verify Setup

  1. Once the Producer project is selected. Open the Navigation menu (Navigation menu) and click Compute Engine > VM instances.

  2. In the VM instance view, you should see 1 VM, with a name starting with app-servers-XXXX.

  3. Then click on the SSH button next to your instance:.

  4. In the SSH session window use the following command.

curl -k localhost

Expected Output

<!DOCTYPE html> <html> <head> <title>Welcome to the Producer Webapp</title> <meta charset="UTF-8"> </head> <body> <h1>Webapp Server</h1> <h3>Congratulations! You are successfully connected.</h3> </body> </html>
  1. From the Compute Engine menu select Instance groups
  2. In the Instance group view click on the appserver-igm instance name. You should see green check marks indicating the instance status and instance health is ok.
  3. Next on the Navigation menu > click VPC Network.
  4. In the VPC network area you should see a VPC network named app-network with 1 subnet 10.0.24.0/24

Task 2. Configure an internal application load balancer in producer project

Set up a proxy only network for Internal Application Load Balancer

  1. Under networking options choose VPC networks.
  2. On the VPC network page select the app-network
  3. On the app-network page visit the Subnets tab and select Add subnet
add subnets
  1. In the add a subnet window apply the following settings:
  2. Set the name field to
  3. Set the region field to
  4. Set the purpose field to
  5. Set the ipv4 field to
  6. Click the ADD button
reserver proxy-only subnet
  1. When the operation is completed, move to next step

Create an internal application Load Balancer

  1. Open the Navigation menu > View all Products > Network services > Load balancing.
  2. Click Create Load Balancer
  3. Select Application load balancer (HTTP/HTTPS) and click Next
  4. Under Public facing of internal select Internal then click Next
  5. Under Cross-region or single-region deployment select Best for regional workloads then click Next
  6. Under Create load balancer select Configure
  7. At the top under Create regional internal Application Load Balancer use the name ilb-pro-app
  8. Region select
  9. Under network select app-network
  10. Select Backend configuration and on the right hand pane under Create or select backend services click Create a backend service
  11. Choose Create a backend service using the following values:
Configuration Name
Name web-app-be
Backend type Instance group
Protocol HTTP
Instance group appserver-igm
Port number 80, 8080
  1. Scroll down and under Health check
  2. Create a health check, named: applb-hc with the following settings:
health check options
  1. Click Create
  2. On the main page click CREATE to complete then OK.
  3. Next select Frontend configuration and use the following:
Configuration Name
Name ilb-fe
Protocol HTTP
Subnetwork app-subnet
Port 80
IP Address Create IP Address
  1. You will see the reserve a static internal IP address window open
  2. In the Reserve a static internal IP address window. Use the following:
Configuration Name
Name ilb-ip
Static IP let me choose
  1. Set a Custom IP address as 10.0.24.100
  2. Select RESERVE to complete
  3. Next select Done.
  4. From the main page click Create to complete the load balancer creation.
load balancer complete

Click Check my progress to verify the objective. Configure internal application load balancer

Task 3. Publish service in Producer Network

Publish service in producer network using Private Service Connect

  1. Go to the Network services and select Private Service Connect.
  2. Switch to the Published Services tab.
  3. Select the Publish Service button.
d5f89fb7561c586f.png
  1. Go to the publish service page under Load balancer type
  2. Select Regional internal Application Load balancer
  3. Under internal load balancer option select ilb-pro-app
  4. For service name use producer-serv
  5. Scroll down select Subnets. Under subnets select Reserve New Subnet.
  6. In the reserve subnet for Private Service Connect use the following
Configuration Value
Name psc-net
Region us-central1
IPv4 range 10.0.88.0/24
  1. To complete select ADD and then OK
  2. Under Connection preference select Automatically accept all connections.
  3. Select Add Service to complete.
  4. Once completed under the published service tab select the producer-serv service name.
  5. In the Private Service Connect service details page copy the name of the Service attachment it should start with projects/ .
Note: You will need this information later in the lab to configure the PSC endpoint in the customer project. psc service attachment

Click Check my progress to verify the objective. Publish service using Private Service Connect

Task 4. Create a Private Service Connect Endpoint in consumer project

Switch between projects. At the left on the landing page look for the CONSUMER PROJECT ID and take note.

  1. At the top of your console on the right next to Google Cloud icon, click the dropdown and then select the all tab.
project bar project bar 2
  1. From the listed project select the customer project to continue.
  2. Under Network Services and select Private Service Connect
  3. On the Connected Endpoints tab, in the Endpoint section select Connect Endpoint
psc configure endpoint
  1. In the connect endpoint page configure as follows:
Configuration Value
Target Published service
Target service Paste the service address you copied in the previous section. Task 3, step 14
Endpoint name remote-app
Network customer-net
Subnetwork psc-subnet
IP Address Create IP address, name psc-ip.In the Static IP box select let me choose.Use the custom IP address box to enter 192.168.30.100 and click Reserve and click OK
  1. In the Service Directory section select Enable API if the option is present. This takes a few minutes to enable the API.
  2. Once complete in the namespace box select Create namespace
  3. For the Namespace name use psc-service and click Create
  4. On the main page click Add Endpoint to complete.
psc-endpoint

Click Check my progress to verify the objective. Create a Private Service Connect endpoint

Task 5. Test connectivity to service using service directory endpoint IP in consumer project

Test connectivity from test VM in the consumer project

  1. In the Consumer project open the Navigation menu > click Compute Engine > VM Instance.

  2. In the VM instance view you should see 1 VM called customer-vm, select the ssh option to open a SSH session into the VM.

  3. In the VM SSH window do a curl to the IP address of the endpoint just created. Use the following command e.g.:

curl 192.168.30.100

You should get a successful return from the service in the producer project.

Expected Output

<!DOCTYPE html> <html> <head> <title>Welcome to the Producer Webapp</title> <meta charset="UTF-8"> </head> <body> <h1>Webapp Server</h1> <h3>Congratulations! You are successfully connected.</h3> </body> </html>

Task 6. Configure Service Directory and Cloud DNS

Link Service Directory to a DNS private zone

  1. In the Consumer project Open the Navigation menu > View all Products > Network services and select Service Directory
  2. In the Service Directory page you should see the following namespace and service you created.
service directory
  1. Now from the left menu, switch to Cloud DNS in the Network Service area and select the Create Zone.
cloud dns
  1. In the create DNS zone area
Configuration Value
Zone type Private
Zone name psc-service-us-central1
DNS name us-central1.p.app.com
Options Use a service directory namespace
Networks Click Add Networks and select customer-net
Region us-central1
Namespace psc-service
  1. Click Create to complete.
  2. Once completed, move to the next task.

Click Check my progress to verify the objective. Configure Service directory and Cloud DNS

Task 7. Test connectivity to service using private dns and endpoint name in consumer project

When using a private DNS name linked to the Service Directory you can access the service even if the IP is changed at any point.

  1. In the Consumer project open the Navigation menu > click Compute Engine > VM Instance.

  2. In the VM instance view you should see a VM called customer-vm

  3. Return to the SSH session of the VM

  4. In the VM use the curl command to view the endpoint response.

curl remote-app.{{{project_1.default_region | "REGION"}}}.p.app.com

Expected Output

<!DOCTYPE html> <html> <head> <title>Welcome to the Producer Webapp</title> <meta charset="UTF-8"> </head> <body> <h1>Webapp Server</h1> <h3>Congratulations! You are successfully connected.</h3> </body> </html>

You should get a successful return from the service in the producer project.

Congratulations!

Congratulations, you've successfully configured Private Service Connect, Service Directory and private DNS!

Reference docs

Manual Last Updated March 10, 2026

Lab Last Tested March 10, 2026

Copyright 2026 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개만 가능

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

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

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