Sitemap
Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Tutorial Series : Application Hub in Google Cloud : Part 2 — Creating an Application

--

Welcome to Part 2 of the series on Application Hub (App Hub) in Google Cloud.

Part 1 : Introduction
Part 2 : Creating an App Hub application : this post
Part 3 : Application monitoring

The previous part gave you an overview of App Hub and what it’s designed to address. If you’ve not read the first part, I recommend reading it.

If I pick and reiterate a few things from the previous post, the first one that leads us into this blog post is “App Hub helps organize infrastructure resources by creating App Hub applications”.

This part of the series will focus on creating an App Hub application.

Application, Services and Workloads

First we need to get a few definitions going and they are important. I am going to quote the definitions from the documentation:

  • An application is a functional grouping of services and workloads that results in an end-to-end business functionality.
  • A workload represents a binary deployment that performs the smallest logical subset of a business functionality, for example, a managed instance group (MIG) or Google Kubernetes Engine (GKE) deployment.
  • A service is a network or API interface that exposes functionality to clients for consumption over the network; for example, the forwarding rule for a load balancer.

To give you a simplified picture to get started with, consider the following:

  1. I have followed this codelab “Build a Travel Agent using MCP Toolbox for Databases and Agent Development Kit (ADK)” to deploy an Agent UI that uses the MCP Toolbox to interact with a Cloud SQL instance and provide some answers on hotels in certain cities.
  2. What is going on inside the codelab is not very important for the discussion here but here are the resources deployed:
    - Cloud SQL instance (hoteldb-instance)
    - Cloud Run service (toolbox)
    - Cloud Run service (Agent UI — hotels-service)

3. The way it works at runtime is as follows:
Agent UI → toolbox → hoteldb-instance

4. At a high level, I would like to consider that all these 3 resources form a group and together I would like to call it an application, say Travel Agent App.

5. When someone says, there is something wrong with the Travel Agent App, I would like to zoom into this application, check the 3 resources, get some help on observability (logs, metrics) for these resources and so on.

Now, this is just one application Travel Agent App that we are talking about here but you can now imagine, how you would conceptually start grouping the underlying resources (in this case, services together as an application).

So our next step, will be to understand how do we take some of our existing resources and group them as Applications or in other words, let’s use App Hub to create our applications.

Organizing our cloud resources into an Application

How do we create these applications? Is doing all this manually in App Hub, the only way to do it? Are there tools currently in the Cloud Assist arsenal, that eventually do this behind the scenes for us (I am giving some hint of what is coming a bit later on in the series) but for now, we are going to keep things simple, so that you can work with these building blocks on your own.

You will also there are recommended ways to structure/organize your projects into App Enabled folders (GCP Resource Hierarchy) that make it auto-enabled for Cloud Assist features and Monitoring, but some of the existing ways are considered legacy, but let’s bear with that for a while. I don’t want to immediately throw in too many terms like host projects, service projects, boundaries between them, app-enabled folders, etc.

Let’s just create one on our own and see what is going on.

Note: I might skip a few things around enabling APIs or setting up the correct roles (IAM) as needed. Do look up the documentation and if you encounter those while performing some of the steps shown here, please do the needful. For all practical purposes here, I will assume that you have a Google Cloud Project to work with, Billing is enabled, you have Owner / Creator roles and can enable the necessary Google Cloud APIs as needed. Additionally and most important, do choose a Google Cloud Project that has multiple resources already in it (Cloud Run services, Cloud Storage buckets, Database instances, and more). This is needed because to construct an Application, we need to compose that from one of more underlying infrastructure resources in your Google Cloud Project.

Enabling the App Hub API for the project

Visit the App Hub page from your Google Cloud console. If you have never enabled App Hub API before in your project, you would see a screen that looks like this:

Currently, the recommended way to configure App Hub is via App-enabled folders. This is the same folder that you create in the Organization -> Folders -> Projects resource hierarchy. When you enable a folder as App-enabled, it creates a management project that helps to group infrastructure resources as services and workloads in App Hub applications, across all the projects under the folder and access to features such as Application Design Center and Gemini Cloud Assist. We will cover some of this a bit later in the series.

For the purpose of this blog post, we are going to go with the legacy method i.e. Designate the project as a host project. You will see the Enable API button, which enables the App Hub API for the project. Please go ahead and do that. On successful enabling (give it some time to sync), you should have a screen that still has the option to upgrade to app-enabled folders, but that’s fine for now.

Using a Host Project

What we have done is to designate the current Google Cloud project as a Host Project. By default right now, the Host Project is the current Google Cloud project and it has one service project (current one) attached to it. Think of a Host Project as having several service projects attached to it and you could then group services and workloads from several projects into a single Application.

We will keep it simple and we have our Google Cloud Project as the host project and it has itself added as a service project. If you would like to confirm that, visit the Settings page from here and you will see that. My screen looks like this:

You will notice that you can attach other projects too via the Attach projects link.

App Hub supported resources

Great ! Now, we need to get back to the Applications menu option from the left, so that we get back to the original screen. You can see that it is empty and there are no applications that have been defined.

Before we define our Application, let’s understand the various Services and Workloads that are discovered by App Hub and which we can potentially use to group into an application.

Visit the Services and workloads menu option and you will see a list of services that have got discovered from my project. You are likely to see a different set of resources that are available. That brings me to an earlier point that you should choose a Google Cloud project that has some resources for you to play with.

The first question you should ask here, are all Google Cloud Resources (global, regional) supported i.e. can be discovered and put in an Application? The answer as always is “it depends”. It depends on the currently supported resources in the product. Do go through the list below.

Creating an Application

Go to the Applications menu option in the App Hub service in Google Cloud console and click on the Create Application link at the top.

This will bring up a list of screens that you need to go through to create the application. Let’s fill in the details:

Note that we can either go for Global or Regional scope for the resources. I have currently gone for Regional (us-central1) resources only. I also provide an Application Name and a Display name.

You can either click on Create button right now or provide additional metadata (attributes and owners). This is useful because as we will see later, it is possible for you to use Cloud Assist Chat and other search mechanisms to query your applications depending on environment (Production, Test, Dev) or based on owner names / emails (Developer, Business, Operator).

Click on Continue and fill out the details as per your understanding of the current environment for the application that you are defining. I have the following values for the two screens:

and

Finally, I click on Create button. It leads me to the details for the Hotel Search App that has just been created. As expected, we have only created the Application object and not added any Services / Workloads to it, hence it is an empty list in terms of what the Application contains.

At this moment, we can just go back and you will see the app listed in the list of applications, as shown below:

Let’s click on the app to register the workloads and services. This will lead you back to the details for the Applicaiton and specifically the Services and workloads section.

We are now going to register the services and workloads that comprise this application. Let us revisit what I mentioned was there in my application.

My Hotel Search App has the following key services that I would like to group into this application:

  • Cloud SQL instance (hoteldb-instance)
  • Cloud Run service (toolbox)
  • Cloud Run service — Agent UI service (hotels-service)

At runtime, as mentioned, I have the following request flow:

Agent UI (hotels-service) → toolbox → hoteldb-instance

All we need to do now is to click on Register service/workload and from the list of discovered resources, you can add them with required details. I am providing the screens for the 3 resources that I am adding one by one (Register them).

Hotel Search UI — Cloud Run service
Toolbox App — Cloud Run service
Hotel Search database — Cloud SQL instance

The final Hotel Search app that I have defined now looks like this:

So now we have defined an App, its constituent services and this is a good foundational step to look at things via an App-centric way. You can always register or unregister services/workloads as you see fit. This is dynamic and not locked down, once you have created the application.

Notice that I could have given Criticality and Environment while defining the services too, but I left them empty. This is not to discount its utility. This could come in handy while querying in the future, so do make use of that. You can always edit the configuration and add these metadata attributes.

What is interesting to note here, is that you can now even saved from going through multiple screens for accessing the individual services. For e.g. under the column, Infrastructure resources, you see that the correct Cloud console page for the specific service is provided as a link for you. You can click on that and you will be led to the exact page in the console. This is super handy to save lots of time that you would have otherwise spent navigating around.

For e.g. , if I click on the hotel-search-ui Cloud Run service link, I am led to the familiar Cloud Run service details page, as shown below:

In conclusion

We’ve covered some good ground in understanding how you can use the App Hub service to start creating/defining Applications, thereby setting things up for you to organize your resources in an Application Centric way.

Stay tuned for upcoming parts, as we go deeper but if you are already curious, go ahead and click on Application monitoring or the individual observability dashboard for each of the services.

Do let me know if you have any feedback on the series. Thank you in advance.

--

--

Google Cloud - Community
Google Cloud - Community

Published in Google Cloud - Community

A collection of technical articles and blogs published or curated by Google Cloud Developer Advocates. The views expressed are those of the authors and don't necessarily reflect those of Google.

Romin Irani
Romin Irani

Written by Romin Irani

My passion is to help developers succeed. ¯\_(ツ)_/¯

Responses (1)