התחברות ל-Cloud SQL ל-PostgreSQL מהסביבה הגמישה של App Engine

במאמר הזה מוסבר איך לפרוס אפליקציה לדוגמה בסביבה גמישה של App Engine שמחוברת למופע PostgreSQL באמצעות מסוף Google Cloud ואפליקציית לקוח.

בהנחה שמשלימים את כל השלבים בזמן, העלות של המשאבים שנוצרו במדריך למתחילים הזה היא בדרך כלל פחות מדולר אחד (USD).

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

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

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

  6. מפעילים את ממשקי Cloud API שנדרשים להרצת אפליקציית לדוגמה של Cloud SQL בסביבה גמישה של App Engine.

    המסוף

    כדי להפעיל את ממשקי ה-API שנדרשים למדריך למתחילים הזה, לוחצים על הכפתור שלמטה.

    הפעלת ממשקי API

    ההגדרה הזו מאפשרת שימוש בממשקי ה-API הבאים:

    • Cloud SQL Admin API
    • Compute Engine API
    • Cloud Build API
    • Cloud Logging API

    בלחיצה על הכפתור, אתם גם מפעילים את הסביבה הגמישה של Google App Engine.

    gcloud

    לוחצים על הלחצן הבא כדי לפתוח את Cloud Shell, שנותן גישה לשורת הפקודה של Google Cloud המשאבים ישירות מהדפדפן. אפשר להשתמש ב-Cloud Shell כדי להריץ את הפקודות של gcloud שמוצגות במדריך למתחילים הזה.

    פתיחת Cloud Shell

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