Deploy a MySQL instance with App Lifecycle Manager

Learn how to deploy a Cloud SQL instance using App Lifecycle Manager.

Before you begin

  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account .

  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 App Lifecycle Manager, Artifact Registry, Cloud Build, Cloud Storage, Developer Connect, Infrastructure Manager, Design Center, App Hub, Cloud Resource Manager, Identity and Access Management, Cloud Asset Inventory, Cloud Monitoring, Cloud Logging, and Service Health 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. Create a service account:

    1. Ensure that you have the Create Service Accounts IAM role ( roles/iam.serviceAccountCreator ) and the Project IAM Admin role ( roles/resourcemanager.projectIamAdmin ). Learn how to grant roles .
    2. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    3. Select your project.
    4. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart .

    5. Click Create and continue .
    6. Grant the Project > Owner role to the service account.

      To grant the role, find the Select a role list, then select Project > Owner .

    7. Click Continue .
    8. Click Done to finish creating the service account.

  6. Install the Google Cloud CLI.

  7. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  8. To initialize the gcloud CLI, run the following command:

    gcloud  
    init
  9. 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

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

  11. Enable the App Lifecycle Manager, Artifact Registry, Cloud Build, Cloud Storage, Developer Connect, Infrastructure Manager, Design Center, App Hub, Cloud Resource Manager, Identity and Access Management, Cloud Asset Inventory, Cloud Monitoring, Cloud Logging, and Service Health 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

  12. Create a service account:

    1. Ensure that you have the Create Service Accounts IAM role ( roles/iam.serviceAccountCreator ) and the Project IAM Admin role ( roles/resourcemanager.projectIamAdmin ). Learn how to grant roles .
    2. In the Google Cloud console, go to the Create service account page.

      Go to Create service account
    3. Select your project.
    4. In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.

      In the Service account description field, enter a description. For example, Service account for quickstart .

    5. Click Create and continue .
    6. Grant the Project > Owner role to the service account.

      To grant the role, find the Select a role list, then select Project > Owner .

    7. Click Continue .
    8. Click Done to finish creating the service account.

  13. Install the Google Cloud CLI.

  14. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity .

  15. To initialize the gcloud CLI, run the following command:

    gcloud  
    init
  16. Grant the App Lifecycle Manager service account the required permissions:
    1. Navigate to App Lifecycle Manager> Overview Get started.

      Go to Get started with App Lifecycle Manager

    2. In the banner with the message The required permissions for App Lifecycle Manager account haven't been granted, click Grant permissions.

Model your Cloud SQL offering using a composite template

In this section, you'll use App Lifecycle Manager to model a composite template ( sql-quickstart-template ) consisting of a Cloud SQL instance using Application Design Center.

  1. In Google Cloud console, go to App Lifecycle Manager> SaaS Offering.

    Go to SaaS Offering

  2. Click Create.

  3. In the Name of the SaaS offeringfield, type: my-sql-quickstart-saas-offering .

  4. In the Regiondrop-down, select the regions:

    • us-central1
    • us-east1
    • us-east5

    Click Ok.

  5. Click Create. It may take a few minutes to create my-sql-quickstart-saas-offering .

    The SaaS offering detailspage opens.

  6. On the SaaS offering detailspage, click Create new template.

  7. On the Create a new composite templatepage:

    1. In the Template IDbox, enter sql-quickstart-template .
    2. Click Create template. App Lifecycle Manager will take a few minutes to create the composite template.

      When App Lifecycle Manager has created the template successfully, you'll see its details in the Connected application templatesection of the SaaS offering detailspage.

  8. In the Connected application templatesection, go to Manage template> Configure in canvas.

    App Design Center opens in the Google Cloud console window.

  9. In the Componentsarea, find and click the Cloud SQL (My SQL)template.

    A Cloud SQL (My SQL)component is added to the canvas.

  10. Click Continue> Deploy at scale with App Lifecycle Manager.

    App Lifecycle Manager opens in the Google Cloud console window.

  11. In the Connected application templatesection, click Update template revision.

  12. On the Update template revisionpage, select r-2 in the Revisiondrop-down.

  13. Click Update. The Connected application templatesection displays Importing Application Template.

    It may take a few minutes for App Lifecycle Manager to import the template revision. When the revision has finished importing, you'll see the list of unit kinds populated in the Unit kindstab.

Provision a Cloud SQL instance using App Lifecycle Manager

In this section, you'll create and provision a unit ( my-sql-quickstart-unit ) with a Cloud SQL instance in the us-central1 region.

  1. On the SaaS offering detailspage of my-sql-quickstart-saas-offering , click Provision.

    A Provisionpage opens.

  2. On the Provisionpage, select us-central1 in the Regiondrop-down.

    Click Addto add a unit to your SaaS offering.

  3. On the Add unit to provisionpanel:

    1. In the Unit namebox, type my-sql-quickstart-unit-1 .
    2. In the Unit kinddrop-down, select the sql-quickstart-template unit kind.
    3. In the Releasedrop-down, select ( r-3 ).
    4. In the Service accountdrop-down, select the service account you created in the Before you begin section.
  4. Click Add tenant project variables.

    1. Select your project to provision your resources.
  5. In the Other input variablessection of the Add unit to provisionpanel:

    1. Click the sql-my-sql-1_database_version drop-down.

      • In the Variable valuebox, type MY_SQL_8_0 .

      Click Done.

    2. Click the sql-my-sql-1_name drop-down.

      • In the Variable valuebox, type my-sql-db-1 .

      Click Done.

    3. Click the sql-my-sql-1_project_id drop-down.

      • In the Variable valuebox, type your project ID.

      Click Done.

    4. Click the sql-my-sql-1_region drop-down.

      • In the Variable valuebox, type us-central1 .

      Click Done.

    Click Add. You'll see my-sql-quickstart-unit-1 in the Units to be provisionedtable.

  6. Click Provisionto provision the my-sql-quickstart-unit-1 which will create a live Cloud SQL instance in your SaaS offering.

    It may take a few minutes for App Lifecycle Manager to provision my-sql-quickstart-unit-1 .

View the deployed Cloud SQL instance

You have now used App Lifecycle Manager to deploy a Cloud SQL instance.

To view the Cloud SQL instance that you deployed in this quickstart:

  1. In Google Cloud console, go to the App Lifecycle Manager> Units> Unit detailspage.

    Go to Units

  2. Click the name of your unit: my-sql-quickstart-unit-1 .

  3. On the Unit detailspage:

    1. See that the Stateis:

      • Readyif the Cloud SQL instance is provisioned.
      • Provisioningif the operation is still in progress.

Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

Delete the project

If you deployed the Cloud SQL instance in a new Google Cloud project, and if you no longer need the project, then delete it by completing the following steps:

  1. In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete .
  3. At the prompt, type the project ID, and then click Shut down .

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: