Deploy an application with App Lifecycle Manager

App Lifecycle Manager lets you automate the deployment and lifecycle management of multi-component applications, which helps you provision consistent environments across Google Cloud. In this quickstart, you model a composite application template with Cloud Run and Cloud Storage in Application Design Center, and then provision a live unit.

Before you begin

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

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

  3. Enable the App Lifecycle Manager, Artifact Registry, Cloud Build, Cloud Run, Cloud Storage, Developer Connect, Infrastructure Manager, App Design Center, App Hub, Resource Manager, Identity and Access Management, Cloud Asset Inventory, Cloud Monitoring, Cloud Logging, and Service Health APIs, if any are not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the APIs

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

  5. Grant the App Lifecycle Manager service account the required permissions:
    1. In the Google Cloud console, go to App Lifecycle Manager > Overview > Get started.

      Go to Get started with App Lifecycle Manager

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

Model your offering using a composite template

Use App Lifecycle Manager and Application Design Center to model a composite template (run-storage-quickstart) that connects a Cloud Run service to a Cloud Storage bucket.

Configure your SaaS offering

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

    Go to SaaS offering

  2. Click Create.

  3. In the SaaS offering name field, enter run-storage-quickstart-offering.

  4. In the Region list, select the following regions, and then click OK:

    • us-central1
    • us-east1
    • us-east5
  5. Click Create. Creating run-storage-quickstart-offering takes a few minutes.

    When the SaaS offering is created, the SaaS offering details page opens.

Create a composite template

  1. On the SaaS offering details page, click Create new template.
  2. On the Create a new composite template page, configure the template:

    1. In the Template ID field, enter run-storage-quickstart.
    2. Click Create template.

      When App Lifecycle Manager finishes creating the composite template, its details appear in the Connected application template section of the SaaS offering details page.

  3. In the Connected application template section, click Manage template, and then click Configure in canvas.

    App Design Center opens in the Google Cloud console.

  4. In the Components area, add the following components to the design canvas:

    1. Click Cloud Run (Service) to add a cloud-run-1 component to the canvas.
    2. Click Cloud Storage to add a cloud-storage-1 component to the canvas.
  5. On the canvas, drag from the cloud-run-1 component to the cloud-storage-1 component to create a connection.

    Connecting the components passes the Cloud Run service account to the Cloud Storage bucket's IAM binding with the roles/storage.objectAdmin role.

  6. On the canvas, click the cloud-run-1 component to open the Configuration panel:

    1. In the Containers area, expand Container 1.
    2. In the Container Image field, enter the public sample container image us-docker.pkg.dev/cloudrun/container/hello:latest.
    3. Click Save.
  7. Click Continue > Deploy at scale with App Lifecycle Manager.

    App Lifecycle Manager opens in the Google Cloud console.

  8. In the Connected application template section, click Update template revision.

  9. On the Update template revision page, select r-2 in the Revision list, and then click Update.

    The Connected application template section displays Importing Application Template. When the import finishes, the Unit kinds tab lists the generated u-native-components unit kind.

Provision the application using App Lifecycle Manager

  1. On the SaaS offering details page of run-storage-quickstart-offering, click Provision.

    The Provision page opens.

  2. On the Provision page, select us-central1 in the Region list, and then click Add.

  3. On the Add unit to provision panel, configure the unit:

    1. In the Unit name field, enter run-storage-quickstart-unit-1.
    2. In the Unit kind list, select the u-native-components unit kind.
    3. In the Release list, select the generated release for your template revision.
    4. In the Service account list, select the actuation service account that you created in the Before you begin section.
  4. Click Add tenant project variables, and then select your project, which will be used to provision the resources.

  5. In the Other input variables area, click Add input variable and enter values for the following component input variables:

    • Name: cloud-run-1_project_id, Variable type: String, and Variable value: your project ID
    • Name: cloud-run-1_location, Variable type: String, and Variable value: us-central1
    • Name: cloud-run-1_service_name, Variable type: String, and Variable value: quickstart-web
    • Name: cloud-storage-1_project_id, Variable type: String, and Variable value: your project ID
    • Name: cloud-storage-1_location, Variable type: String, and Variable value: us-central1
    • Name: cloud-storage-1_name, Variable type: String, and Variable value: a globally unique bucket name, such as PROJECT_ID-quickstart-bkt
  6. Click Add. The run-storage-quickstart-unit-1 unit appears in the Units to be provisioned table.

  7. Click Provision to deploy run-storage-quickstart-unit-1.

    The Cloud Run service and Cloud Storage provision after a few minutes.

  8. To provision additional units in other regions, select the region from the Region list and then click Add.

View the deployed unit

Verify that App Lifecycle Manager provisioned your unit and its resources.

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

    Go to Units

  2. Click run-storage-quickstart-unit-1 to open the Unit details page.

  3. On the Unit details page, check the State field:

    • Ready: the Cloud Run service and Cloud Storage bucket are provisioned.
    • Provisioning: the deployment 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 application resources 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