Skip to main content

Query DW Service Units

This topic introduces how to query database objects in a DW service unit through the Relyt console or by using a Terraform script.


Query DW service units through Relyt console

  1. Sign in to your data cloud as a cloud account with the SYSTEMADMIN system role.

    If you sign in as the main account, click the role next to your account name, and switch the system role from ACCOUNTADMIN to SYSTEMADMIN. This is because only SYSTEMADMIN has the privileges to create DW service units. For details about system roles, see Introduction to Cloud Accounts and System Roles.

  2. Choose DW Service Units from the top navigation bar. You will see a list of all the DW service units you have access to on this page.


Use a Terraform script to query DW service units

Before you start

Ensure you have obtained the endpoint for access. For details about how to check endpoints, see Query Endpoints.

Procedure

  1. Download the latest Terraform script.

    Following is a code snippet example from the module for listing databases. Configure the parameters according to your needs.

    terraform {
    required_providers {
    relyt = {
    source = "relytcloud/relyt"
    }
    }
    }

    data "relyt_dwsus" "dwsus" {}
  2. Run the following command to initialize the Terraform working directory.

    terraform init
  3. Run the following command to apply the module.

    terraform apply --target=module.relyt_dwsu_list
  4. When prompted, enter yes to confirm the operation.

  5. When Apply complete is displayed, run the following command.

    terraform show

    Information similar to the following will be displayed.

    In this example, only one DW service unit is returned.

    Fields returned for each DW service unit include:

    • alias: the alias of the DW service unit.

    • cloud: the cloud provider where the DW service unit is deployed. It is fixed to aws.

    • edition: the edition of the DW service unit.

    • endpoints: a list of endpoints that can be used to access the DW service unit.

      Each endpoint object contains:

      • host: the host name.

      • id: a reserved parameter. Ignore this field.

      • open: whether the endpoint is public. true indicates the endpoint is public. false indicates the endpoint is private and accessible only via private connections.

      • port: the port number.

      • protocol: the protocol used for access.

      • type: the type of the endpoint. Possible values include web_console and database.

        • web_console: used for accessing the DW service unit console.

        • database: used for accessing databases in the DW service unit.

      • uri: the URI of the endpoint.