Creating and Registering a Service in Consul

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this hands-on lab, you will be provided a single server running the Consul agent in developer mode. Your task is to create a basic service file and to use that file to register a service in Consul. Then you will check to ensure the service is showing in the Consul catalog.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Log in and Test Consul
  1. Log in to the server using the credentials provided.
  2. Verify Consul is ready for use.

(Note: It may take several minutes before Consul is ready for use.)

Create a Service Registration File for Two Services
  1. Create a file called "web-services" in either HCL or JSON format. This file should use whatever stanza’s are required for two services.
  2. First service.
    • Name: web
    • Tag: web-server
    • Port: 80
  3. Second service.
    • Name: web-database
    • Tag: web-server-database
    • Port: 3128
Register the Two Services in Consul
  1. Register the services file you just created using Consul.
Verify Services Are in the Consul Catalog
  1. Confirm services, web and web-database have been successfully registered.

Additional Resources

You have been tasked with creating a service in Consul to register two services in the one service file. Name this file "web-services" and create the following two services. You may use either HCL or JSON for the file format.

  1. First service
    • Name: web
    • Tag: web-server
    • Port: 80
  2. Second service
    • Name: web-database
    • Tag: web-server-database
    • Port: 3128

Once you have created the file, register this file with the Consul agent provided, and confirm if the services have been registered. Finally run a DNS check for the services, web.service.consul and web-database.service.consul to verify an IP address is returned.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!