1. מבוא
מארחים מקומיים יכולים להגיע לחיזויים אונליין באופן מקורי דרך האינטרנט הציבורי (אפשרות 1) או באמצעות Cloud VPN או Cloud Interconnect עם Private Service Connect (PSC) (אפשרות 2) מהרשת המקומית, כאשר שתי האפשרויות מציעות הצפנת SSL/TLS. קישוריות היברידית לחיזוי אונליין דרך קישוריות הדדית (interconnect) מספקת ביצועים טובים יותר מאשר קישוריות לאינטרנט, ולכן מומלצת לאפליקציות קריטיות, כפי שמוצג באיור 1.
במדריך הזה נדגים איך להשתמש ב-HA VPN כדי לגשת באופן פרטי לחיזויים אונליין בין שתי רשתות VPC שיכולות לשמש כבסיס לקישוריות פרטית בין כמה עננים ולקישוריות פרטית מקומית.
שימו לב, Vertex Online Prediction היא נקודת קצה ציבורית, ולכן כדאי להגביל את הגישה באמצעות VPC Service Controls (VPC-SC) כדי ליצור היקפים מאובטחים שיאפשרו או יחסמו את הגישה ל-Vertex ול-Googleapis אחרים. המדריך הזה לא כולל מידע על VPC-SC. לפרטים נוספים אפשר לעיין במאמר בנושא VPC Service Controls עם Vertex AI.

מה תפַתחו
תגדירו רשת VPC בשם on-prem-vpc כדי לייצג סביבה מקומית. בפריסה שלכם, on-prem-vpc לא יופיע, ובמקומו ייעשה שימוש ברשת היברידית לחיבור למרכז הנתונים המקומי או לספק שירותי הענן.
תבנו ארכיטקטורה מקיפה של Private Service Connect שממחישה גישה לחיזויים אונליין באופן ציבורי באמצעות Cloud NAT, ובאופן פרטי באמצעות PSC דרך HA VPN, בהתאם לפרטים שבהמשך.

אחרי שהתחזית אונליין תיפרס בפרויקט Google Cloud, נבדוק את התרחישים הבאים לדוגמה:
גישה ציבורית לחיזוי אונליין כוללת את הפעולות הבאות:
- יצירת מכונת GCE (nat-client) שממנפת NAT לגישה לאינטרנט ליציאה
- שימוש ב-CURL כדי להסיק מסקנות לגבי המודל
- שימוש ב-TCPDUMP כדי לוודא שיש גישה לחיזוי אונליין דרך כתובת VIP ציבורית
גישה פרטית לחיזוי אונליין, שכוללת את הדברים הבאים:
- פריסת מודל לנקודת קצה של תחזית אונליין ב-Vertex בפרויקט
- יצירת נקודת קצה (endpoint) מסוג Private Service Connect (Googleapis) ב-aiml-vpc
- מייצאים את כתובת ה-IP של PSC דרך Cloud Router כפרסום מותאם אישית אל ה-VPC המקומי
- יוצרים מכונת GCE (לקוח פרטי) ומעדכנים את קובץ etc/hosts עם כתובת ה-IP של נקודת הקצה של PSC
- שימוש ב-CURL כדי להסיק מסקנות מהמודל
- שימוש ב-TCPDUMP כדי לוודא שיש גישה לחיזוי אונליין דרך כתובת ה-IP של נקודת הקצה של PSC
מה תלמדו
- איך יוצרים נקודת קצה מסוג Private Service Connect
- איך מפרסמים את כתובת ה-IP של נקודת הקצה של PSC דרך Cloud Router
- איך משתמשים ב-TCPDUMP כדי לאמת גישה לחיזוי אונליין, גם ציבורית וגם פרטית
מה תצטרכו
- פרויקט ב-Google Cloud
הרשאות IAM
2. לפני שמתחילים
עדכון הפרויקט כדי לתמוך במדריך
במדריך הזה נעשה שימוש ב-$variables כדי לעזור בהטמעה של הגדרות gcloud ב-Cloud Shell.
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud config list project
gcloud config set project [YOUR-PROJECT-NAME]
projectid=YOUR-PROJECT-NAME
echo $projectid
3. הפעל שירותים
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud services enable dns.googleapis.com
gcloud services enable aiplatform.googleapis.com
gcloud services enable iam.googleapis.com
gcloud services enable compute.googleapis.com
gcloud services enable notebooks.googleapis.com
4. הגדרה של aiml-vpc
יצירת aiml-vpc
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud compute networks create aiml-vpc --project=$projectid --subnet-mode=custom
יצירת רשת משנה של מחברת שמנוהלת על ידי משתמש
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud compute networks subnets create workbench-subnet --project=$projectid --range=172.16.10.0/28 --network=aiml-vpc --region=us-central1 --enable-private-ip-google-access
הגדרות של Cloud Router ו-NAT
במדריך נעשה שימוש ב-Cloud NAT להורדות של חבילות תוכנה של מחברות, כי למופע של מחברת בניהול המשתמש אין כתובת IP חיצונית. Cloud NAT מציע גם יכולות NAT ליציאה, כלומר למארחים באינטרנט אסור ליזום תקשורת עם מחברת שמנוהלת על ידי המשתמש, מה שהופך אותה למאובטחת יותר.
ב-Cloud Shell, יוצרים את Cloud Router האזורי.
gcloud compute routers create cloud-router-us-central1-aiml-nat --network aiml-vpc --region us-central1
ב-Cloud Shell, יוצרים את שער Cloud NAT האזורי.
gcloud compute routers nats create cloud-nat-us-central1 --router=cloud-router-us-central1-aiml-nat --auto-allocate-nat-external-ips --nat-all-subnet-ip-ranges --region us-central1
5. הגדרה של on-prem-vpc
יצירת on-prem-vpc
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud compute networks create on-prem-vpc --project=$projectid --subnet-mode=custom
יצירת תת-הרשת nat-subnet
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud compute networks subnets create nat-subnet --project=$projectid --range=192.168.10.0/28 --network=on-prem-vpc --region=us-central1
יצירת תת-רשת של כתובות IP פרטיות
ב-Cloud Shell, מבצעים את הפעולות הבאות:
gcloud compute networks subnets create private-ip-subnet --project=$projectid --range=192.168.20.0/28 --network=on-prem-vpc --region=us-central1
הגדרות של Cloud Router ו-NAT
במדריך נעשה שימוש ב-Cloud NAT להורדות של חבילות תוכנה. שירות Cloud NAT מציע גם יכולות NAT ליציאה, כלומר למארחים באינטרנט אין אפשרות ליצור תקשורת עם שירות Compute, ולכן הוא מאובטח יותר.
ב-Cloud Shell, יוצרים את Cloud Router האזורי.
gcloud compute routers create cloud-router-us-central1-on-prem-nat --network on-prem-vpc --region us-central1
ב-Cloud Shell, יוצרים את שער Cloud NAT האזורי.
gcloud compute routers nats create cloud-nat-us-central1 --router=cloud-router-us-central1-on-prem-nat --auto-allocate-nat-external-ips --nat-all-subnet-ip-ranges --region us-central1
6. יצירת נקודת הקצה של Private Service Connect
בקטע הבא, תיצרו נקודת קצה (endpoint) של Private Service Connect (PSC) שתשמש לגישה אל Vertex API מהענן הוירטואלי הפרטי (VPC) המקומי. כתובת ה-IP של PSC 100.100.10.10 תפורסם מ-aiml-vpc-cloud-router-vpn כפרסום נתב מותאם אישית לרשת המקומית בשלב הבא.
מ-Cloud Shell
gcloud compute addresses create psc-ip \
--global \
--purpose=PRIVATE_SERVICE_CONNECT \
--addresses=100.100.10.10 \
--network=aiml-vpc
יצירת נקודת קצה של PSC
מ-Cloud Shell
gcloud compute forwarding-rules create pscvertex \
--global \
--network=aiml-vpc \
--address=psc-ip \
--target-google-apis-bundle=all-apis
הצגת רשימה של נקודות הקצה המוגדרות של Private Service Connect
מ-Cloud Shell
gcloud compute forwarding-rules list \
--filter target="(all-apis OR vpc-sc)" --global
תיאור של נקודות הקצה שהוגדרו ב-Private Service Connect
מ-Cloud Shell
gcloud compute forwarding-rules describe \
pscvertex --global
7. קישוריות היברידית
בקטע הבא תיצרו Cloud Router שיאפשר לכם להחליף מסלולים באופן דינמי בין הענן הווירטואלי הפרטי (VPC) לבין הרשת השכנה באמצעות Border Gateway Protocol (BGP).
Cloud Router יכול להגדיר סשן BGP דרך מנהרת Cloud VPN כדי לחבר את הרשתות שלכם. הוא לומד באופן אוטומטי טווחי כתובות IP חדשים של רשתות משנה ומכריז עליהם ברשת העמיתים.
במדריך הזה תפרסו HA VPN בין aiml-vpc ל-on-prem-vpc.
יצירת שער HA VPN לרשת aiml-vpc
כשכל שער נוצר, מוקצות לו באופן אוטומטי שתי כתובות IPv4 חיצוניות, אחת לכל ממשק של השער.
יוצרים את שער HA VPN ב-Cloud Shell
gcloud compute vpn-gateways create aiml-vpn-gw \
--network=aiml-vpc\
--region=us-central1
יצירת שער HA VPN לרשת on-prem-vpc
כשכל שער נוצר, מוקצות לו באופן אוטומטי שתי כתובות IPv4 חיצוניות, אחת לכל ממשק של השער. חשוב לרשום את כתובות ה-IP האלה כדי להשתמש בהן בהמשך בשלבי ההגדרה.
יוצרים את שער HA VPN ב-Cloud Shell.
gcloud compute vpn-gateways create on-prem-vpn-gw \
--network=on-prem-vpc\
--region=us-central1
אימות של יצירת שער HA VPN
במסוף, עוברים אל HYBRID CONNECTIVITY → VPN → CLOUD VPN GATEWAYS ומוודאים שכתובות ה-IP של השער נוצרו.

יצירת Cloud Router עבור aiml-vpc
ב-Cloud Shell, יוצרים את Cloud Router שנמצא ב-us-central1
gcloud compute routers create aiml-cr-us-central1 \
--region=us-central1 \
--network=aiml-vpc\
--asn=65001
יצירת Cloud Router עבור on-prem-vpc
ב-Cloud Shell, יוצרים את Cloud Router שנמצא ב-us-central1
gcloud compute routers create on-prem-cr-us-central1 \
--region=us-central1 \
--network=on-prem-vpc \
--asn=65002
יצירת מנהרות VPN עבור aiml-vpc
תצרו שתי מנהרות VPN בכל שער HA VPN.
יצירת מנהרת VPN tunnel0
ב-Cloud Shell, יוצרים את tunnel0:
gcloud compute vpn-tunnels create aiml-vpc-tunnel0 \
--peer-gcp-gateway on-prem-vpn-gw \
--region us-central1 \
--ike-version 2 \
--shared-secret [ZzTLxKL8fmRykwNDfCvEFIjmlYLhMucH] \
--router aiml-cr-us-central1 \
--vpn-gateway aiml-vpn-gw \
--interface 0
יצירת מנהרת VPN 1
ב-Cloud Shell, יוצרים את המנהרה tunnel1:
gcloud compute vpn-tunnels create aiml-vpc-tunnel1 \
--peer-gcp-gateway on-prem-vpn-gw \
--region us-central1 \
--ike-version 2 \
--shared-secret [bcyPaboPl8fSkXRmvONGJzWTrc6tRqY5] \
--router aiml-cr-us-central1 \
--vpn-gateway aiml-vpn-gw \
--interface 1
יצירת מנהרות VPN עבור on-prem-vpc
תצרו שתי מנהרות VPN בכל שער HA VPN.
יצירת מנהרת VPN tunnel0
ב-Cloud Shell, יוצרים את tunnel0:
gcloud compute vpn-tunnels create on-prem-tunnel0 \
--peer-gcp-gateway aiml-vpn-gw \
--region us-central1 \
--ike-version 2 \
--shared-secret [ZzTLxKL8fmRykwNDfCvEFIjmlYLhMucH] \
--router on-prem-cr-us-central1 \
--vpn-gateway on-prem-vpn-gw \
--interface 0
יצירת מנהרת VPN 1
ב-Cloud Shell, יוצרים את המנהרה tunnel1:
gcloud compute vpn-tunnels create on-prem-tunnel1 \
--peer-gcp-gateway aiml-vpn-gw \
--region us-central1 \
--ike-version 2 \
--shared-secret [bcyPaboPl8fSkXRmvONGJzWTrc6tRqY5] \
--router on-prem-cr-us-central1 \
--vpn-gateway on-prem-vpn-gw \
--interface 1
אימות של יצירת מנהרת VPN
במסוף, עוברים אל HYBRID CONNECTIVITY (קישוריות היברידית) → VPN → CLOUD VPN TUNNELS (מנהרות Cloud VPN).

8. הגדרת שכנים ב-BGP
יצירת סשנים של BGP
בקטע הזה תגדירו ממשקים של Cloud Router ורשתות שכנות של BGP.
יצירת ממשק BGP וקישור בין רשתות שכנות עבור aiml-vpc
ב-Cloud Shell, יוצרים את ממשק ה-BGP:
gcloud compute routers add-interface aiml-cr-us-central1 \
--interface-name if-tunnel0-to-onprem \
--ip-address 169.254.1.1 \
--mask-length 30 \
--vpn-tunnel aiml-vpc-tunnel0 \
--region us-central1
ב-Cloud Shell, יוצרים את הקישור בין רשתות שכנות באמצעות BGP:
gcloud compute routers add-bgp-peer aiml-cr-us-central1 \
--peer-name bgp-on-premises-tunnel0 \
--interface if-tunnel1-to-onprem \
--peer-ip-address 169.254.1.2 \
--peer-asn 65002 \
--region us-central1
ב-Cloud Shell, יוצרים את ממשק ה-BGP:
gcloud compute routers add-interface aiml-cr-us-central1 \
--interface-name if-tunnel1-to-onprem \
--ip-address 169.254.2.1 \
--mask-length 30 \
--vpn-tunnel aiml-vpc-tunnel1 \
--region us-central1
ב-Cloud Shell, יוצרים את הקישור בין רשתות שכנות באמצעות BGP:
gcloud compute routers add-bgp-peer aiml-cr-us-central1 \
--peer-name bgp-on-premises-tunnel1 \
--interface if-tunnel2-to-onprem \
--peer-ip-address 169.254.2.2 \
--peer-asn 65002 \
--region us-central1
יצירת ממשק BGP וקישור בין רשתות שכנות עבור on-prem-vpc
ב-Cloud Shell, יוצרים את ממשק ה-BGP:
gcloud compute routers add-interface on-prem-cr-us-central1 \
--interface-name if-tunnel0-to-aiml-vpc\
--ip-address 169.254.1.2 \
--mask-length 30 \
--vpn-tunnel on-prem-tunnel0 \
--region us-central1
ב-Cloud Shell, יוצרים את הקישור בין רשתות שכנות באמצעות BGP:
gcloud compute routers add-bgp-peer on-prem-cr-us-central1 \
--peer-name bgp-aiml-vpc-tunnel0 \
--interface if-tunnel1-to-aiml-vpc\
--peer-ip-address 169.254.1.1 \
--peer-asn 65001 \
--region us-central1
ב-Cloud Shell, יוצרים את ממשק ה-BGP:
gcloud compute routers add-interface on-prem-cr-us-central1 \
--interface-name if-tunnel1-to-aiml-vpc\
--ip-address 169.254.2.2 \
--mask-length 30 \
--vpn-tunnel on-prem-tunnel1 \
--region us-central1
ב-Cloud Shell, יוצרים את הקישור בין רשתות שכנות באמצעות BGP:
gcloud compute routers add-bgp-peer on-prem-cr-us-central1 \
--peer-name bgp-aiml-vpc-tunnel1\
--interface if-tunnel2-to-aiml-vpc\
--peer-ip-address 169.254.2.1 \
--peer-asn 65001 \
--region us-central1
עוברים אל Hybrid CONNECTIVITY → VPN כדי לראות את פרטי מנהרת ה-VPN.

אימות של מסלולים שנלמדו על ידי aiml-vpc דרך HA VPN
באמצעות המסוף, עוברים אל רשת VPC ← רשתות VPC ← aiml-vpc← מסלולים ← אזור ← US-CENTRAL1 ← הצגה
שימו לב שהרשת aiml-vpc למדה מסלולים מרשת המשנה nat-subnet ומרשת המשנה private-ip-subnet של הרשת on-prem-vpc

אימות לכך שרשת on-prem-vpc למדה את workbench-subnet דרך HA-VPN
במסוף, עוברים אל רשת VPC → VPC networks → on-prem-vpc → ROUTES → REGION → US-CENTRAL1 → VIEW

9. יצירת פרסום של מסלולים מותאמים אישית ב-aiml-vpc
כתובת ה-IP של נקודת הקצה של Private Service Connect לא מפורסמת באופן אוטומטי על ידי נתב הענן aiml-cr-us-central1 כי רשת המשנה לא מוגדרת ב-VPC.
במקום זאת, תצטרכו ליצור פרסום של מסלול בהתאמה אישית מנתב הענן aiml-cr-us-central לכתובת ה-IP של נקודת הקצה 100.100.10.10, שתפורסם בסביבה המקומית דרך BGP אל on-prem-vpc.
במסוף, עוברים אל HYBRID CONNECTIVITY → CLOUD ROUTERS → aiml-cr-us-central1 ולוחצים על EDIT (עריכה).

בקטע 'מסלולים שפורסמו', בוחרים באפשרות יצירת מסלולים בהתאמה אישית, מעדכנים את השדות לפי הדוגמה שבהמשך, בוחרים באפשרות סיום ואז לוחצים על שמירה.

אימות
אימות לכך שרשת ה-VPC המקומית למדה את כתובת ה-IP של נקודת הקצה של PSC דרך HA-VPN
במסוף, עוברים אל רשת VPC → VPC networks → on-prem-vpc → ROUTES → REGION → US-CENTRAL1 → VIEW

10. יצירת פרסום של מסלולים מותאמים אישית ב-on-prem-vpc
נתב הענן on-prem-vpc מפרסם את כל רשתות המשנה כברירת מחדל, אבל נדרשת רק רשת המשנה private-ip-subnet.
בקטע הבא, מעדכנים את הפרסום של המסלול מ-Cloud Router on-prem-cr-us-central1.
במסוף, עוברים אל HYBRID CONNECTIVITY → CLOUD ROUTERS → on-prem-cr-us-central1 ולוחצים על EDIT.

בקטע 'מסלולים שפורסמו', בוחרים באפשרות יצירת מסלולים בהתאמה אישית, מעדכנים את השדות לפי הדוגמה שבהמשך, בוחרים באפשרות סיום ואז לוחצים על שמירה.

אימות
מוודאים ש-aiml-vpc למד את הנתיב של רשת המשנה של כתובות ה-IP הפרטיות מ-on-prem-vpc.
במסוף, עוברים אל רשת VPC ← רשתות VPC ← aiml-vpc ← מסלולים ← אזור ← US-CENTRAL1 ← הצגה

11. יצירת חשבון שירות שמנוהל על ידי משתמש (מופעי GCE)
כדי לספק רמת בקרה גבוהה על Vertex API, נדרש חשבון שירות שמנוהל על ידי המשתמש, שיוחל על מופעי הלקוח הפרטיים ועל מופעי ה-NAT. אחרי שיוצרים את ההרשאות לחשבון השירות, אפשר לשנות אותן בהתאם לדרישות העסקיות. במדריך, לחשבון השירות בניהול המשתמשים, vertex-sa, יוקצו התפקידים הבאים:
לפני שממשיכים, צריך את Service Account API.
ב-Cloud Shell, יוצרים את חשבון השירות.
gcloud iam service-accounts create gce-vertex-sa \
--description="service account for vertex" \
--display-name="gce-vertex-sa"
ב-Cloud Shell, מעדכנים את חשבון השירות עם התפקיד compute instance admin
gcloud projects add-iam-policy-binding $projectid --member="serviceAccount:gce-vertex-sa@$projectid.iam.gserviceaccount.com" --role="roles/compute.instanceAdmin.v1"
ב-Cloud Shell, מעדכנים את חשבון השירות עם התפקיד Vertex AI User
gcloud projects add-iam-policy-binding $projectid --member="serviceAccount:gce-vertex-sa@$projectid.iam.gserviceaccount.com" --role="roles/aiplatform.user"
12. יצירה של חשבון שירות שמנוהל על ידי משתמש (מחברת)
בקטע הבא תיצרו חשבון שירות שמנוהל על ידי משתמש, שיהיה משויך ל-Vertex Workbench (Notebook) שבו נעשה שימוש במדריך.
במדריך הזה, התפקידים הבאים יוקצו לחשבון השירות:
ב-Cloud Shell, יוצרים את חשבון השירות.
gcloud iam service-accounts create user-managed-notebook-sa \
--display-name="user-managed-notebook-sa"
ב-Cloud Shell, מעדכנים את חשבון השירות עם התפקיד Storage Admin (אדמין אחסון).
gcloud projects add-iam-policy-binding $projectid --member="serviceAccount:user-managed-notebook-sa@$projectid.iam.gserviceaccount.com" --role="roles/storage.admin"
ב-Cloud Shell, מעדכנים את חשבון השירות עם התפקיד Vertex AI User.
gcloud projects add-iam-policy-binding $projectid --member="serviceAccount:user-managed-notebook-sa@$projectid.iam.gserviceaccount.com" --role="roles/aiplatform.user"
ב-Cloud Shell, מעדכנים את חשבון השירות עם התפקיד Artifact Registry Admin.
gcloud projects add-iam-policy-binding $projectid --member="serviceAccount:user-managed-notebook-sa@$projectid.iam.gserviceaccount.com" --role="roles/artifactregistry.admin"
ב-Cloud Shell, מפרטים את חשבון השירות ורושמים את כתובת האימייל שתשמש ליצירת מחברת שמנוהלת על ידי משתמש.
gcloud iam service-accounts list
13. יצירת מופעי הבדיקה
בקטע הבא תיצרו מופעי בדיקה כדי לאמת שיטות שונות להגעה אל ממשקי Vertex API, במיוחד:
- המופע,
nat-client,ישתמש ב-Cloud NAT כדי לפתור את Vertex AI, ולכן תהיה לו גישה לנקודת הקצה של חיזוי אונליין דרך האינטרנט - המכונה
private-clientתשתמש בכתובת ה-IP של Private Service Connect 100.100.10.10 כדי לגשת לנקודת הקצה של Online Prediction דרך HA-VPN.
ב-Cloud Shell, יוצרים את מכונת nat-client.
gcloud compute instances create nat-client \
--zone=us-central1-a \
--image-family=debian-11 \
--image-project=debian-cloud \
--subnet=nat-subnet \
--service-account=vertex-sa@$projectid.iam.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--no-address \
--metadata startup-script="#! /bin/bash
sudo apt-get update
sudo apt-get install tcpdump dnsutils -y"
ב-Cloud Shell, יוצרים את מכונת private-client.
gcloud compute instances create private-client \
--zone=us-central1-a \
--image-family=debian-11 \
--image-project=debian-cloud \
--subnet=private-ip-subnet \
--service-account=vertex-sa@$projectid.iam.gserviceaccount.com \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--no-address \
--metadata startup-script="#! /bin/bash
sudo apt-get update
sudo apt-get install tcpdump dnsutils -y"
כדי לאפשר לשרת proxy לאימות זהויות (IAP) להתחבר למכונות הווירטואליות, צריך ליצור כלל חומת אש ש:
- רלוונטי לכל מכונות ה-VM שרוצים לגשת אליהן באמצעות IAP.
- מאפשר תעבורת נתונים נכנסת (ingress) מטווח כתובות ה-IP 35.235.240.0/20. הטווח הזה מכיל את כל כתובות ה-IP שמשמשות את IAP להעברת TCP.
ב-Cloud Shell, יוצרים את הכלל בחומת האש של IAP.
gcloud compute firewall-rules create ssh-iap-on-prem-vpc \
--network on-prem-vpc \
--allow tcp:22 \
--source-ranges=35.235.240.0/20
14. יצירת מחברת שמנוהלת על ידי משתמש
בקטע הבא, יוצרים מחברת שמנוהלת על ידי משתמש שמשלבת את חשבון השירות שנוצר קודם, user-managed-notebook-sa.
ב-Cloud Shell, יוצרים את המכונה private-client.
gcloud notebooks instances create workbench-tutorial \
--vm-image-project=deeplearning-platform-release \
--vm-image-family=common-cpu-notebooks \
--machine-type=n1-standard-4 \
--location=us-central1-a \
--subnet-region=us-central1 \
--subnet=workbench-subnet \
--no-public-ip --service-account=user-managed-notebook-sa@$projectid.iam.gserviceaccount.com
15. פריסת המודל ותחזית אונליין
בקטע הבא, משתמשים ב-Codelab Vertex AI:שימוש בשגרות חיזוי מותאמות אישית עם Sklearn לעיבוד מקדים ולעיבוד פוסט של נתונים לצורך חיזוי. מתחילים בקטע 7 כי כבר יצרתם מחברת בשלב הקודם. אחרי שמבצעים פריסה של המודל, חוזרים למדריך כדי להתחיל את הקטע הבא.

16. אימות הגישה ל-Vertex API דרך האינטרנט
בקטע הבא תתחברו למופע nat-client ותאמתו את הקישוריות ל-Vertex AI באמצעות הפקודות dig ו-tcpdump מול הדומיין us-central1-aiplatform.googleapis.com שמשמש לפתרון בעיות ב-Vertex APIs.
מתחברים אל nat-client באמצעות IAP ב-Cloud Shell כדי לאמת את הקישוריות אל Vertex API על ידי ביצוע dig מול דומיין Vertex us-central1-aiplatform.googleapis.com
gcloud compute ssh nat-client --project=$projectid --zone=us-central1-a --tunnel-through-iap
מריצים את הפקודה dig.
dig us-central1-aiplatform.googleapis.com
לדוגמה, שימו לב לכתובות ה-IP הציבוריות בתגובת ה-DNS.
user@nat-client:~$ dig us-central1-aiplatform.googleapis.com
; <<>> DiG 9.16.42-Debian <<>> us-central1-aiplatform.googleapis.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 56761
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;us-central1-aiplatform.googleapis.com. IN A
;; ANSWER SECTION:
us-central1-aiplatform.googleapis.com. 300 IN A 108.177.111.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.250.1.95
us-central1-aiplatform.googleapis.com. 300 IN A 108.177.121.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.250.103.95
us-central1-aiplatform.googleapis.com. 300 IN A 108.177.120.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.251.171.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.250.159.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.251.120.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.251.161.95
us-central1-aiplatform.googleapis.com. 300 IN A 142.251.172.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.126.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.70.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.132.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.201.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.202.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.69.95
;; Query time: 4 msec
;; SERVER: 169.254.169.254#53(169.254.169.254)
;; WHEN: Thu Jun 29 01:35:57 UTC 2023
;; MSG SIZE rcvd: 322
ממערכת ההפעלה של לקוח ה-NAT, מריצים tcpdump כדי לאמת את פענוח ה-DNS כשמבצעים curl מול התחזית אונליין.
sudo tcpdump -i any port 53 -n
דוגמה:
user@nat-client:~$ sudo tcpdump -i any port 53 -n
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
פותחים טרמינל חדש ב-Cloud Shell על ידי לחיצה על '+'. אחרי שפותחים את הכרטיסייה החדשה, מעדכנים את משתנה שם הפרויקט.
ב-Cloud Shell, מעדכנים את המשתנה של שם הפרויקט.
gcloud config list project
gcloud config set project [YOUR-PROJECT-NAME]
projectid=YOUR-PROJECT-NAME
echo $projectid
ב-Cloud Shell 2, מבצעים SSH למכונת nat-client.
gcloud compute ssh --zone "us-central1-a" "nat-client" --project "$projectid"
בקטע הבא, תיצרו קובץ instances.json באמצעות sudo VI editor או nano ותוסיפו את מחרוזת הנתונים שמשמשת לקבלת תחזית מהמודל שנפרס.
ממערכת ההפעלה של לקוח ה-NAT, יוצרים קובץ instances.json עם מחרוזת הנתונים שבהמשך:
{"instances": [
[0.23, 'Ideal', 'E', 'VS2', 61.5, 55.0, 3.95, 3.98, 2.43],
[0.29, 'Premium', 'J', 'Internally Flawless', 52.5, 49.0, 4.00, 2.13, 3.11]]}
דוגמה:
user@nat-client:$ more instances.json
{"instances": [
[0.23, 'Ideal', 'E', 'VS2', 61.5, 55.0, 3.95, 3.98, 2.43],
[0.29, 'Premium', 'J', 'Internally Flawless', 52.5, 49.0, 4.00, 2.13, 3.11]]}
user@nat-client:$
מקבלים את מזהה נקודת הקצה של התחזית אונליין מ-Cloud Console, שישמש בשלבים הבאים.
עוברים אל VERTEX AI → ONLINE PREDICTION (חיזוי אונליין)

ממערכת ההפעלה של לקוח ה-NAT, יוצרים את המשתנים הבאים:
gcloud config list project
gcloud config set project [YOUR-PROJECT-NAME]
projectid=YOUR-PROJECT-NAME
echo $projectid
ENDPOINT_ID="insert-your-endpoint-id-here"
דוגמה:
ENDPOINT_ID="3328226095324463104"
ממערכת ההפעלה של לקוח NAT, מבצעים curl כדי לקבל תגובה מהמודל.
curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/${projectid}/locations/us-central1/endpoints/${ENDPOINT_ID}:predict -d @instances.json
לדוגמה, שימו לב שהחיזוי הצליח.
user@nat-client$ curl -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/${projectid}/locations/us-central1/endpoints/${ENDPOINT_ID}:predict -d @instances.json
{
"predictions": [
"$479.0",
"$586.0"
],
"deployedModelId": "1949163636186415104",
"model": "projects/234086459238/locations/us-central1/models/947543727654567936",
"modelDisplayName": "diamonds-cpr",
"modelVersionId": "1"
}
17. אימות – גישה לאינטרנט ל-Vertex API
אחרי שמריצים את החיזוי, אפשר לעיין בתוצאות של TCPDUMP (טרמינל 1) שמציינות את מופע nat-client (192.168.10.2) שמבצע שאילתת DNS לשרת ה-DNS המקומי 169.254.169.254 לדומיין Vertex AI us-central1-aiplatform.googleapis.com. התוצאה של שאילתת ה-DNS היא כתובות IP וירטואליות (VIPS) ציבוריות לממשקי Vertex API, כמו שמצוין בהמשך:
user@nat-client:~$ sudo tcpdump -i any port 53 -n
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
20:05:09.260937 ens4 Out IP 192.168.10.2.40782 > 169.254.169.254.53: 47190+ A? oauth2.googleapis.com. (39)
20:05:09.260946 ens4 Out IP 192.168.10.2.40782 > 169.254.169.254.53: 28075+ AAAA? oauth2.googleapis.com. (39)
20:05:09.263556 ens4 In IP 169.254.169.254.53 > 192.168.10.2.40782: 28075 4/0/0 AAAA 2607:f8b0:4001:c34::5f, AAAA 2607:f8b0:4001:c54::5f, AAAA 2607:f8b0:4001:c16::5f, AAAA 2607:f8b0:4001:c17::5f (151)
20:05:09.265018 ens4 In IP 169.254.169.254.53 > 192.168.10.2.40782: 47190 16/0/0 A 74.125.201.95, A 74.125.202.95, A 74.125.69.95, A 64.233.183.95, A 173.194.193.95, A 173.194.194.95, A 173.194.195.95, A 173.194.196.95, A 173.194.197.95, A 64.233.191.95, A 173.194.74.95, A 173.194.192.95, A 209.85.145.95, A 209.85.146.95, A 209.85.147.95, A 142.250.125.95 (295)
20:05:09.474478 ens4 Out IP 192.168.10.2.57356 > 169.254.169.254.53: 36008+ A? us-central1-aiplatform.googleapis.com. (55)
20:05:09.474488 ens4 Out IP 192.168.10.2.57356 > 169.254.169.254.53: 47020+ AAAA? us-central1-aiplatform.googleapis.com. (55)
20:05:09.477190 ens4 In IP 169.254.169.254.53 > 192.168.10.2.57356: 36008 16/0/0 A 173.194.194.95, A 173.194.195.95, A 173.194.196.95, A 173.194.197.95, A 173.194.74.95, A 173.194.192.95, A 209.85.145.95, A 209.85.146.95, A 209.85.147.95, A 142.250.125.95, A 142.250.136.95, A 142.250.148.95, A 209.85.200.95, A 209.85.234.95, A 142.250.152.95, A 142.250.128.95 (311)
20:05:09.478607 ens4 In IP 169.254.169.254.53 > 192.168.10.2.57356: 47020 4/0/0 AAAA 2607:f8b0:4001:c1b::5f, AAAA 2607:f8b0:4001:c0c::5f, AAAA 2607:f8b0:4001:c0e::5f, AAAA 2607:f8b0:4001:c1e::5f (167)
18. הפעלת גישה פרטית לממשקי Vertex API
בקטע הבא, תהיה לכם גישה לממשקי Vertex API באמצעות Private Service Connect דרך רשת היברידית (HA VPN) כדי להגיע באופן פרטי לחיזוי אונליין. בדוגמה שבה נעשה שימוש במדריך, תעדכנו את הקובץ /etc/hosts במופע של הלקוח הפרטי.
בסביבה מקומית, מתאים לעדכן קובץ /etc/hosts במכונה אחת או בכמה מכונות לצורך בדיקה. עם זאת, בסביבות ייצור ובסביבות בקנה מידה גדול, עדיף ליצור אזור העברה חדש באמצעות ה-FQDN של נקודת הקצה של PSC.
לדוגמה, נקודת הקצה של ה-PSC שנוצרה במדריך נקראת pscvertex, ומתורגמת ל-pscvertex.p.googleapis.com.כשמשתמשים בנקודת הקצה של Vertex, צריך לצרף את ה-FQDN לשירות, למשל us-central1-aiplatform-pscvertex.p.googleapis.com.
כדי לעדכן את ה-DNS המקומי באמצעות נקודת הקצה (endpoint) של PSC, צריך גם לבצע רפקטורינג של האפליקציות המקומיות כדי לקרוא ל-FDQN, למשל us-central1-aiplatform-pscvertex.p.googleapis.com, במקום לנקודת הקצה הציבורית המקורית us-central1-aiplatform.googleapis.com.
לקוחות שאפשר להגדיר להם נקודת קצה בהתאמה אישית יכולים להשתמש בשמות ה-DNS p.googleapis.com כדי לשלוח בקשות לנקודת קצה.
בתיעוד של הלקוח או של ספריית הלקוח מוסבר איך להגדיר אותם לשימוש בנקודות קצה מותאמות אישית. לדוגמה:
- Python: אפשר להגדיר את api_endpoint במחלקה Client options בחבילה google-api-core.
- Go: אפשר להגדיר את WithEndpoint בחבילת אפשרויות הלקוח בחבילת ה-API.
- gcloud: You can configure api_endpoint_overrides
פותחים טרמינל חדש ב-Cloud Shell על ידי לחיצה על '+'. אחרי שפותחים את הכרטיסייה החדשה, מעדכנים את משתנה שם הפרויקט.
מ-Cloud Shell.
gcloud config list project
gcloud config set project [YOUR-PROJECT-NAME]
projectid=YOUR-PROJECT-NAME
echo $projectid
מתחברים ל-private-client באמצעות IAP ב-Cloud Shell חדש כדי לאמת את הקישוריות ל-Vertex API על ידי ביצוע dig מול דומיין Vertex us-central1-aiplatform.googleapis.com
מ-Cloud Shell, מתחברים למכונת מערכת ההפעלה של הלקוח הפרטי.
gcloud compute ssh private-client --project=$projectid --zone=us-central1-a --tunnel-through-iap
מריצים את הפקודה dig.
dig us-central1-aiplatform.googleapis.com
לדוגמה, שימו לב לכתובות ה-IP הציבוריות על סמך תגובת ה-DNS.
user@private-client:~$ dig us-central1-aiplatform.googleapis.com
; <<>> DiG 9.16.42-Debian <<>> us-central1-aiplatform.googleapis.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33311
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;us-central1-aiplatform.googleapis.com. IN A
;; ANSWER SECTION:
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.132.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.201.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.202.95
us-central1-aiplatform.googleapis.com. 300 IN A 74.125.69.95
us-central1-aiplatform.googleapis.com. 300 IN A 64.233.182.95
us-central1-aiplatform.googleapis.com. 300 IN A 64.233.183.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.193.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.194.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.195.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.196.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.197.95
us-central1-aiplatform.googleapis.com. 300 IN A 64.233.191.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.74.95
us-central1-aiplatform.googleapis.com. 300 IN A 173.194.192.95
us-central1-aiplatform.googleapis.com. 300 IN A 209.85.145.95
us-central1-aiplatform.googleapis.com. 300 IN A 209.85.146.95
;; Query time: 4 msec
;; SERVER: 169.254.169.254#53(169.254.169.254)
;; WHEN: Sun Jul 02 20:5
מעדכנים את המופע של הלקוח הפרטי /etc/hosts באמצעות sudo VI editor או nano כדי ליצור רשומה של ה-FQDN של Vertex AI us-central1-aiplatform.googleapis.com שמפנה לנקודת הקצה של PSC 100.100.10.10. לא נדרשים שינויים נוספים.
דוגמה:
user@private-client:~$ more /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
100.100.10.10 us-central1-aiplatform.googleapis.com
192.168.20.2 private-client.c.$projectid.internal private-client # Added by Google
169.254.169.254 metadata.google.internal # Added by Google
ממערכת ההפעלה של הלקוח הפרטי, מבצעים PING לנקודת קצה ל-API של Vertex.
ping us-central1-aiplatform.googleapis.com
לדוגמה, הפקודה PING מחזירה את כתובת ה-IP של נקודת הקצה של ה-PSC, אבל לא צפויה תשובה.
user@private-client:~$ ping us-central1-aiplatform.googleapis.com
PING us-central1-aiplatform.googleapis.com (100.100.10.10) 56(84) bytes of data.
ממערכת ההפעלה של הלקוח הפרטי, מריצים tcpdump כדי לאמת את פתרון ה-DNS ואת נתיב הנתונים של ה-IP לנקודת הקצה של ה-PSC כשמבצעים curl מול התחזית אונליין.
sudo tcpdump -i any port 53 -n or host 100.100.10.10
פותחים טרמינל רביעי של Cloud Shell על ידי לחיצה על '+'. אחרי שפותחים את הכרטיסייה החדשה, מעדכנים את משתנה שם הפרויקט.
ב-Cloud Shell, מעדכנים את המשתנה של שם הפרויקט.
gcloud config list project
gcloud config set project [YOUR-PROJECT-NAME]
projectid=YOUR-PROJECT-NAME
echo $projectid
ב-Cloud Shell 4, מבצעים SSH למופע של לקוח פרטי.
gcloud compute ssh --zone "us-central1-a" "private-client" --project "$projectid"
בקטע הבא, תיצרו קובץ instances.json באמצעות sudo VI editor או nano ותוסיפו את מחרוזת הנתונים שמשמשת לקבלת תחזית מהמודל שנפרס.
במערכת ההפעלה של הלקוח הפרטי, יוצרים קובץ instances.json עם מחרוזת הנתונים שבהמשך:
{"instances": [
[0.23, 'Ideal', 'E', 'VS2', 61.5, 55.0, 3.95, 3.98, 2.43],
[0.29, 'Premium', 'J', 'Internally Flawless', 52.5, 49.0, 4.00, 2.13, 3.11]]}
דוגמה:
user@private-client:$ more instances.json
{"instances": [
[0.23, 'Ideal', 'E', 'VS2', 61.5, 55.0, 3.95, 3.98, 2.43],
[0.29, 'Premium', 'J', 'Internally Flawless', 52.5, 49.0, 4.00, 2.13, 3.11]]}
user@private-client:$
במערכת ההפעלה של הלקוח הפרטי, יוצרים את המשתנים הבאים:
gcloud config list project
projectid=YOUR-PROJECT-NAME
echo $projectid
ENDPOINT_ID="insert-your-endpoint-id-here"
דוגמה:
ENDPOINT_ID="3328226095324463104"
ממערכת ההפעלה של הלקוח הפרטי ב-Cloud Shell 4, מבצעים curl כדי לקבל תגובה מהמודל.
curl -v -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/${projectid}/locations/us-central1/endpoints/${ENDPOINT_ID}:predict -d @instances.json
19. אימות – גישה פרטית ל-Vertex API
ממערכת ההפעלה של הלקוח הפרטי ב-Cloud Shell 4, שימו לב שכתובת ה-IP של נקודת הקצה של PSC (100.100.10.10) שימשה לגישה ל-Vertex API.
user@private-client$ curl -v -X POST -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://us-central1-aiplatform.googleapis.com/v1/projects/${projectid}/locations/us-central1/endpoints/${ENDPOINT_ID}:predict -d @instances.json
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 100.100.10.10:443...
* Connected to us-central1-aiplatform.googleapis.com (100.100.10.10) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
* subject: CN=upload.video.google.com
* start date: May 29 08:21:36 2023 GMT
* expire date: Aug 21 08:21:35 2023 GMT
* subjectAltName: host "us-central1-aiplatform.googleapis.com" matched cert's "*.googleapis.com"
* issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x55f2ab65c2c0)
> POST /v1/projects/$projectid/locations/us-central1/endpoints/3328226095324463104:predict HTTP/2
> Host: us-central1-aiplatform.googleapis.com
> user-agent: curl/7.74.0
> accept: */*
> authorization: Bearer ya29.a0AbVbY6NdCbIJYj0mQROeq-xYgQCw534TTtjRc1kBAEOimKCFxb3gqgD5AvhfefJatSNr33eW1YJirfQVMptFoqfjRoB-i8zEJJ_GGCVqhsVnpSOjK0hzJQSuo2YGjIiSe1o1zdo7lWmh1Px-vLe8FImieGkrQ1hqVaa6aCgYKAXgSARESFQFWKvPlUQ_FuKB2hrDJRyFDjupL1g0171
> content-type: application/json
> content-length: 154
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
* We are completely uploaded and fine
< HTTP/2 200
< content-type: application/json; charset=UTF-8
< x-vertex-ai-internal-prediction-backend: harpoon
< date: Mon, 03 Jul 2023 22:13:35 GMT
< vary: X-Origin
< vary: Referer
< vary: Origin,Accept-Encoding
< server: scaffolding on HTTPServer2
< cache-control: private
< x-xss-protection: 0
< x-frame-options: SAMEORIGIN
< x-content-type-options: nosniff
< accept-ranges: none
<
{
"predictions": [
"$479.0",
"$586.0"
],
"deployedModelId": "1949163636186415104",
"model": "projects/234086459238/locations/us-central1/models/947543727654567936",
"modelDisplayName": "diamonds-cpr",
"modelVersionId": "1"
}
* Connection #0 to host us-central1-aiplatform.googleapis.com left intact
ממסוף TCPDUMP ב-Cloud Shell 3, אפשר לוודא שלא נצפה חיפוש DNS ל-us-central1-aiplatform.googleapis.com כי קובץ hosts קיבל עדיפות, אבל כתובת ה-IP של PSC 100.100.10.10 שימשה בנתיב הנתונים.
user@private-client:~$ sudo tcpdump -i any port 53 -n or host 100.100.10.10
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
22:13:35.507625 ens4 Out IP 192.168.20.2.37004 > 169.254.169.254.53: 58585+ A? oauth2.googleapis.com. (39)
22:13:35.507631 ens4 Out IP 192.168.20.2.37004 > 169.254.169.254.53: 15580+ AAAA? oauth2.googleapis.com. (39)
22:13:35.511796 ens4 In IP 169.254.169.254.53 > 192.168.20.2.37004: 58585 16/0/0 A 142.251.6.95, A 108.177.112.95, A 74.125.124.95, A 172.217.212.95, A 172.217.214.95, A 172.253.114.95, A 172.253.119.95, A 108.177.111.95, A 142.250.1.95, A 108.177.121.95, A 142.250.103.95, A 108.177.120.95, A 142.251.171.95, A 142.250.159.95, A 142.251.120.95, A 142.251.161.95 (295)
22:13:35.512002 ens4 In IP 169.254.169.254.53 > 192.168.20.2.37004: 15580 4/0/0 AAAA 2607:f8b0:4001:c2b::5f, AAAA 2607:f8b0:4001:c18::5f, AAAA 2607:f8b0:4001:c5f::5f, AAAA 2607:f8b0:4001:c58::5f (151)
22:13:35.722145 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [S], seq 1951267724, win 65320, options [mss 1420,sackOK,TS val 1371205990 ecr 0,nop,wscale 7], length 0
22:13:35.730727 ens4 In IP 100.100.10.10.443 > 192.168.20.2.47304: Flags [S.], seq 3198878726, ack 1951267725, win 65535, options [mss 1366,sackOK,TS val 67847676 ecr 1371205990,nop,wscale 8], length 0
22:13:35.730760 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [.], ack 1, win 511, options [nop,nop,TS val 1371205999 ecr 67847676], length 0
22:13:35.738339 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [P.], seq 1:518, ack 1, win 511, options [nop,nop,TS val 1371206006 ecr 67847676], length 517
22:13:35.739922 ens4 In IP 100.100.10.10.443 > 192.168.20.2.47304: Flags [.], ack 518, win 261, options [nop,nop,TS val 67847688 ecr 1371206006], length 0
22:13:35.740860 ens4 In IP 100.100.10.10.443 > 192.168.20.2.47304: Flags [.], seq 1:2709, ack 518, win 261, options [nop,nop,TS val 67847689 ecr 1371206006], length 2708
22:13:35.740863 ens4 In IP 100.100.10.10.443 > 192.168.20.2.47304: Flags [P.], seq 2709:4699, ack 518, win 261, options [nop,nop,TS val 67847689 ecr 1371206006], length 1990
22:13:35.740874 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [.], ack 2709, win 497, options [nop,nop,TS val 1371206009 ecr 67847689], length 0
22:13:35.740886 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [.], ack 4699, win 485, options [nop,nop,TS val 1371206009 ecr 67847689], length 0
22:13:35.742709 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [P.], seq 518:598, ack 4699, win 501, options [nop,nop,TS val 1371206011 ecr 67847689], length 80
22:13:35.743996 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [P.], seq 598:644, ack 4699, win 501, options [nop,nop,TS val 1371206012 ecr 67847689], length 46
22:13:35.744011 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [P.], seq 644:693, ack 4699, win 501, options [nop,nop,TS val 1371206012 ecr 67847689], length 49
22:13:35.744082 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [P.], seq 693:728, ack 4699, win 501, options [nop,nop,TS val 1371206012 ecr 67847689], length 35
22:13:35.744165 ens4 Out IP 192.168.20.2.47304 > 100.100.10.10.443: Flags [P.], seq 728:1069, ack 4699, win 501, options [nop,nop,TS val 1371206012 ecr 67847689], length 341
הצלחתם לאמת את החיבור לחיזוי אונליין דרך נקודת קצה ציבורית באינטרנט, ובאופן פרטי באמצעות שימוש ברשת היברידית וב-Private Service Connect (googleapis). יוצאים ממערכת ההפעלה וחוזרים להנחיה של Cloud Shell.
20. הסרת המשאבים
ב-Cloud Shell, מוחקים את רכיבי ההדרכה.
gcloud compute forwarding-rules delete pscvertex --global --quiet
gcloud compute instances delete workbench-tutorial --zone=us-central1-a --quiet
gcloud compute addresses delete psc-ip --global --quiet
gcloud compute networks subnets delete workbench-subnet --region=us-central1 --quiet
gcloud compute vpn-tunnels delete aiml-vpc-tunnel0 aiml-vpc-tunnel1 on-prem-tunnel0 on-prem-tunnel1 --region=us-central1 --quiet
gcloud compute vpn-gateways delete aiml-vpn-gw on-prem-vpn-gw --region=us-central1 --quiet
gcloud compute routers delete aiml-cr-us-central1 cloud-router-us-central1-aiml-nat --region=us-central1 --quiet
gcloud compute routers delete cloud-router-us-central1-on-prem-nat on-prem-cr-us-central1 --region=us-central1 --quiet
gcloud compute instances delete nat-client private-client --zone=us-central1-a --quiet
gcloud compute firewall-rules delete ssh-iap-on-prem-vpc --quiet
gcloud compute networks subnets delete nat-subnet private-ip-subnet --region=us-central1 --quiet
gcloud compute networks delete on-prem-vpc --quiet
gcloud compute networks delete aiml-vpc --quiet
מחיקת רכיבים של Vertex
כדי למחוק את קובץ האימג' של הקונטיינר, עוברים אל Artifact Registry, בוחרים את המאגר שיצרתם ולוחצים על מחיקה.

כדי למחוק את קטגוריית האחסון, בתפריט הניווט במסוף Cloud, עוברים אל Storage, בוחרים את הקטגוריה ולוחצים על Delete:

מבטלים את הפריסה של המודל מנקודת הקצה. עוברים אל Vertex AI → חיזוי אונליין → בוחרים diamonds-cpr_endpoint → ביטול הפריסה של המודל מנקודת הקצה → ביטול הפריסה

מוחקים את המודל. עוברים אל Vertex AI → מרשם המודלים → מחיקת מודל

מוחקים את נקודת הקצה של התחזית אונליין. מנווטים אל VertexAI → Online prediction → Select diamonds-cpr_endpoint → Delete endpoint

21. מזל טוב
הגדרתם ואימתתם בהצלחה חיבור לחיזוי אונליין באופן מקורי באמצעות האינטרנט, באופן פרטי באמצעות Private Service Connect ובאמצעות רשת היברידית.
יצרתם nat-client ו-private-client והשתמשתם ב-TCPDUMP כדי לאמת את כתובות ה-IP שמשמשות לגישה אל Vertex APIs. בנוסף, למדתם על Private Service Connect (googleapis) ואיך אפשר להשתמש בו כדי לבודד אפליקציות מקומיות ואפליקציות מרובות עננים באמצעות נקודת קצה (endpoint) של PSC ללקוח.
Cosmopup חושב שסרטוני הדרכה הם מדהימים!!

מה השלב הבא?
כדאי לצפות בסרטוני ההדרכה האלה…
קריאה נוספת וסרטונים
- סקירה כללית על Private Service Connect
- מה זה Private Service Connect?
- איך מקבלים חיזויים ממודל של למידת מכונה
- מה זה Vertex AI?
