ניהול הגישה לתבנית של זמן ריצה

בדף הזה מוסבר איך להעניק ולבטל גישה לתבנית של סביבת זמן ריצה ב-Colab Enterprise.

לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Agent Platform, Dataform, and Compute Engine APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Agent Platform, Dataform, and Compute Engine APIs.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the APIs

התפקידים הנדרשים

כדי לקבל את ההרשאות שנדרשות לניהול הגישה לתבנית של זמן ריצה, צריך לבקש מהאדמין להקצות לכם ב-IAM את התפקיד אדמין של Colab Enterprise ‏ (roles/aiplatform.colabEnterpriseAdmin) בפרויקט. כדי לקרוא הסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.

יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.

הענקת גישה לתבנית של סביבת זמן ריצה

כדי להעניק לישות ראשית גישה לתבנית של זמן ריצה, אפשר להשתמש במסוף Google Cloud , ב-Google Cloud CLI או ב-Terraform.

המסוף

  1. במסוף Google Cloud , נכנסים לדף Runtime templates של Colab Enterprise.

    מעבר אל Runtime templates

  2. בתפריט Region (אזור), בוחרים את האזור שבו נמצאת תבנית זמן הריצה.

  3. בתפריט Runtime template, בוחרים תבנית זמן ריצה. אם לא מופיעות תבניות של זמן ריצה, יוצרים תבנית של זמן ריצה.

  4. לוחצים על  הרשאות.

  5. בחלון Permissions, לוחצים על  Add principal.

  6. בתיבת הדו-שיח Grant access, בשדה New principals, מזינים חשבון משתמש אחד או רשימה של חשבונות משתמשים שמופרדים בפסיקים.

  7. בתפריט Select a role (בחירת תפקיד), משלימים את תיבת הדו-שיח כדי להקצות תפקיד.

  8. אופציונלי: לוחצים על  הוספת תפקיד נוסף וחוזרים על השלב האחרון.

  9. לוחצים על Save.

gcloud

לפני השימוש בנתוני הפקודה הבאים, צריך להחליף את הנתונים הבאים:

  • RUNTIME_TEMPLATE_ID: המזהה של תבנית זמן הריצה.
  • PRINCIPAL: חשבון המשתמש שרוצים להוסיף לו את הקישור.
  • ROLE: שם התפקיד שרוצים להקצות לחשבון המשתמש.
  • PROJECT_ID: מזהה הפרויקט.
  • REGION: האזור שבו נמצאת תבנית זמן הריצה.

מריצים את הפקודה הבאה:

‫Linux,‏ macOS או Cloud Shell

gcloud colab runtime-templates add-iam-policy-binding RUNTIME_TEMPLATE_ID \
    --member=PRINCIPAL \
    --role=ROLE \
    --project=PROJECT_ID \
    --region=REGION

‏Windows (PowerShell)

gcloud colab runtime-templates add-iam-policy-binding RUNTIME_TEMPLATE_ID `
    --member=PRINCIPAL `
    --role=ROLE `
    --project=PROJECT_ID `
    --region=REGION

Windows‏ (cmd.exe)

gcloud colab runtime-templates add-iam-policy-binding RUNTIME_TEMPLATE_ID ^
    --member=PRINCIPAL ^
    --role=ROLE ^
    --project=PROJECT_ID ^
    --region=REGION

מידע נוסף על ניהול מדיניות IAM לתבניות של זמן ריצה משורת הפקודה זמין במסמכי התיעוד של ה-CLI של gcloud.

Terraform

כדי ללמוד איך להחיל הגדרות ב-Terraform או להסיר אותן, ראו פקודות בסיסיות ב-Terraform. למידע נוסף, ראו את מאמרי העזרה לספקים של Terraform.

בדוגמה הבאה נעשה שימוש במשאב Terraform‏ google_colab_runtime_template_iam_policy כדי להעניק גישה לתבנית של זמן ריצה ב-Colab Enterprise.

data "google_iam_policy" "admin" {
  binding {
    role = "roles/viewer"
    members = [
      "user:jane@example.com",
    ]
  }
}

resource "google_colab_runtime_template_iam_policy" "policy" {
  project = google_colab_runtime_template.runtime-template.project
  location = google_colab_runtime_template.runtime-template.location
  runtime_template = google_colab_runtime_template.runtime-template.name
  policy_data = data.google_iam_policy.admin.policy_data
}

חשבונות ראשיים ב-Colab Enterprise הם משתמשים, קבוצות או דומיינים

אפשר לתת גישה למשתמשים, לקבוצות או לדומיינים. הנה טבלה לדוגמה:

חשבון משתמש דוגמה לחשבון משתמש
משתמש יחיד user@gmail.com
קבוצה ב-Google admins@googlegroups.com
דומיין של Google Workspace example.com

ביטול הגישה לתבנית של סביבת זמן ריצה

כדי לבטל את הגישה לתבנית של זמן ריצה, אפשר להשתמש במסוף Google Cloud או ב-CLI של gcloud.

המסוף

  1. נכנסים לדף IAM במסוף Google Cloud .

    כניסה לדף IAM

  2. בוחרים פרויקט, תיקייה או ארגון.

  3. מחפשים את השורה שמכילה את חשבון המשתמש שרוצים לבטל את הגישה שלו. בשורה הזו לוחצים על Edit principal.

  4. לוחצים על Delete בתפקיד שרוצים לבטל, ואז לוחצים על Save.

gcloud

לפני השימוש בנתוני הפקודה הבאים, צריך להחליף את הנתונים הבאים:

  • RUNTIME_TEMPLATE_ID: המזהה של תבנית זמן הריצה.
  • PRINCIPAL: חשבון המשתמש שרוצים לבטל את הגישה שלו.
  • ROLE: התפקיד שרוצים להסיר מהחשבון הראשי.
  • PROJECT_ID: מזהה הפרויקט.
  • REGION: האזור שבו נמצאת תבנית זמן הריצה.

מריצים את הפקודה הבאה:

‫Linux,‏ macOS או Cloud Shell

gcloud colab runtime-templates remove-iam-policy-binding RUNTIME_TEMPLATE_ID \
    --member=PRINCIPAL \
    --role=ROLE \
    --project=PROJECT_ID \
    --region=REGION

‏Windows (PowerShell)

gcloud colab runtime-templates remove-iam-policy-binding RUNTIME_TEMPLATE_ID `
    --member=PRINCIPAL `
    --role=ROLE `
    --project=PROJECT_ID `
    --region=REGION

Windows‏ (cmd.exe)

gcloud colab runtime-templates remove-iam-policy-binding RUNTIME_TEMPLATE_ID ^
    --member=PRINCIPAL ^
    --role=ROLE ^
    --project=PROJECT_ID ^
    --region=REGION

מידע נוסף על ניהול מדיניות IAM לתבניות של זמן ריצה משורת הפקודה זמין במסמכי התיעוד של ה-CLI של gcloud.

המאמרים הבאים