
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Configuring Service Directory
/ 50
Configuring a Service Directory DNS zone
/ 50
Service Directory helps reduce the complexity of management and operations by providing a single place to publish, discover, and connect services. It is a managed service that enhances service inventory management at scale so you don’t have to. Service Directory provides real-time service information, whether you have a few service endpoints or thousands. This helps ensure that your applications only resolve the most updated information of their resources, increasing the reachability of your services.
With Service Directory, you can easily understand all your services across multi-cloud environments. This includes workloads running in Compute Engine VMs, Google Kubernetes Engine (GKE), as well as external services running on-prem and third-party clouds. It improves application reachability by maintaining the endpoint information for all your services.
Service Directory solves the following problems:
Interoperability: Service Directory is a universal naming service that works across Google Cloud, multi-cloud, and on-premises. You can migrate services between these environments and still use the same service name to register and resolve endpoints.
Service management: Service Directory is a managed service. Your organization doesn't have to worry about the high availability, redundancy, scaling, or maintenance concerns of maintaining your own service registry.
Access Control: With Service Directory, you can control who can register and resolve your services using IAM. Assign Service Directory roles to teams, service accounts, and organizations.
Limitations of pure DNS: DNS resolvers can be unreliable in terms of respecting TTLs and caching, cannot handle larger record sizes, and do not offer an easy way to serve metadata to users. In addition to DNS support, Service Directory offers HTTP and gRPC APIs to query and resolve services.
In this lab, you will:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
This section shows how to set up a Service Directory namespace, add a service to the namespace, and add endpoints to a service.
In the Console, search for "network services", then select Network Services.
From the Network Services menu, select Service Directory.
Click Enable to enable the Service Directory API.
In the Service Directory page, click +REGISTER SERVICE.
On the Register service page select Standard for Service type.
Click Next.
In the Region pull-down menu, select a region for your namespace. For this lab, use
In the Namespace field, select CREATE NAMESPACE.
In the Namespace name field give your namespace a name. For this lab, you can use example-namespace
. Click Create.
Enter a Service name. For this lab use example-service
.
Click Create.
Once the service is registered, add some endpoints. An endpoint consists of a unique name and the optional fields of address, port, and key/value metadata. The address, if specified, must be valid IPv4 or IPv6.
In the Service Directory page, click the service you just created.
Click +Add Endpoint.
Provide an Endpoint name. For this example, you can use example-endpoint
.
Enter an IPv4 or IPv6 IP address. For this example, you can use 0.0.0.0
.
Enter a Port number. For this example, you can use 80
.
Click Create.
Click Check my progress to verify the objective.
You can create a Service Directory zone that allows your Google Cloud-based services to query your Service Directory namespace via DNS.
From the Network Services menu, select Cloud DNS.
Click Create zone.
In the Zone type section, select Private.
Give the zone a name. For this example, you can use: example-zone-name
.
Give the zone a DNS name. For this example, you can use: myzone.example.com
.
Under Options, select Use a service directory namespace
.
Under Networks, select one or more networks that can use the Service Directory zone. You should use the default
network here, then click OK.
Select the Region where the namespace you want to link lives. Start typing
Select the Namespace you want to link. This should be the namespace you created earlier example-namespace
.
Click Create.
Click Check my progress to verify the objective.
VPC Service Controls improves your ability to mitigate the risk of data exfiltration from Google Cloud services. With VPC Service Controls, you can configure security perimeters around the resources and data of services that you explicitly specify.
This section covers DNS querying, but there are no tasks you need to complete.
DNS queries for the following record types are supported:
A/AAAA queries must observe the following format:
Optionally:
SRV queries must observe the following format:
Optionally:
You can use Cloud Monitoring and Cloud Logging with Service Directory.
Service Directory produces audit logs that can be viewed through Logging.
Audit logs can help you answer the questions "Who did what, where, and when?". Service Directory writes two types of audit logs: admin activity and data access. Admin activity logs are always enabled and apply to the following Service Directory operations:
All other Service Directory operations are considered data access logs and are not enabled by default. Data access logs are also subject to Logging pricing and quota, whereas neither applies to admin activity logs. To enable data access logging, see Configuring Data Access logs.
To see these logs in Logging, in the Cloud Console, search for "logging" then select Logging. You'll be on the Logs Explorer page.
From the All resources dropdown, select Service Directory Namespace >
Select activity
from the All log names dropdown and click __Apply. You should see one CreateNamespace
log.
In the Cloud Console return to Network Services and select Service Directory.
For the namespace you created, click the three dots on the right side of the row. Click Delete, then Delete again.
Now go back to Logging and go to the Logs Explorer page.
You should now see a DeleteNamespace
log.
Monitoring allows you to create dashboards or set up alerts and can be accessed by visiting Monitoring in Cloud Console.
To view basic monitoring metrics (request count, size and latency), you can go to the Metrics Explorer and filter by resource_type:consumed_api
and service:servicedirectory.googleapis.com
.
In this lab, you set up a Service Directory namespace, added a service to the namespace, and added endpoints to a service. You then created a Service Directory zone that allows your Google Cloud-based services to query your Service Directory namespace via DNS. Finally, you viewed and created admin activity logs CreateNamespace
and DeleteNamespace
.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated February 13, 2025
Lab Last Tested January 22, 2025
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one