Adding drest output to an API tab

This guide uses an example to teach how to add drest output to an API tab.

Creating a client VM

This example creates a client VM (vm-client) in the same region as the backend (server) VMs. The client is used to validate the load balancer's configuration and demonstrate expected behavior as described in the testing section.


  1. Go to the VM instances page in the Google Cloud console.
    Go to the VM instances page
  2. Click Create instance.
  3. Set the Name to vm-client.
  4. Set the Zone to us-west1-a.
  5. Click Management, security, disks, networking, sole tenancy and make the following changes:
    • Click Networking and add the allow-ssh to Network tags.
    • Click the edit button under Network interfaces and make the following changes then click Done:
      • Network: lb-network
      • Subnet: lb-subnet
      • Primary internal IP: Ephemeral (automatic)
      • External IP: Ephemeral
  6. Click Create.


The client VM can be in any zone in the same region as the load balancer, and it can use any subnet in that region. In this example, the client is in the us-west1-a zone, and it uses the same subnet as the backend VMs.

gcloud compute instances create vm-client \
    --zone=us-west1-a \
    --image-family=debian-9 \
    --image-project=debian-cloud \
    --tags=allow-ssh \


Make a POST request to the instances.insert method.

Before using any of the request data, make the following replacements:

  • `PROJECT_ID`: Your project ID
  • `ZONE`: us-west1-a
  • `NETWORK`: lb-network
  • `SUBNET`: lb-subnet

HTTP method and URL:


Request JSON body:

  "kind": "compute#instance",
  "name": "`VM_NAME`",
  "zone": "projects/`PROJECT_ID`/zones/`ZONE`",
  "machineType": "projects/`PROJECT_ID`/zones/`ZONE`/machineTypes/n1-standard-1",
  "displayDevice": {
    "enableDisplay": false
  "metadata": {
    "kind": "compute#metadata",
    "items": []
  "tags": {
    "items": []
  "disks": [
      "kind": "compute#attachedDisk",
      "type": "PERSISTENT",
      "boot": true,
      "mode": "READ_WRITE",
      "autoDelete": true,
      "deviceName": "`VM_NAME`",
      "initializeParams": {
        "sourceImage": "projects/eip-images/global/images/debian-9-drawfork-v20190702",
        "diskType": "projects/`PROJECT_ID`/zones/`ZONE`/diskTypes/pd-standard",
        "diskSizeGb": "10"
      "diskEncryptionKey": {}
  "canIpForward": false,
  "networkInterfaces": [
      "kind": "compute#networkInterface",
      "subnetwork": "projects/`PROJECT_ID`/regions/us-central1/subnetworks/`SUBNET`",
      "accessConfigs": [
          "kind": "compute#accessConfig",
          "name": "External NAT",
          "type": "ONE_TO_ONE_NAT",
          "networkTier": "PREMIUM"
      "aliasIpRanges": []
  "description": "",
  "labels": {},
  "scheduling": {
    "preemptible": false,
    "onHostMaintenance": "MIGRATE",
    "automaticRestart": true,
    "nodeAffinities": []
  "deletionProtection": false,
  "reservationAffinity": {
    "consumeReservationType": "ANY_RESERVATION"
  "serviceAccounts": [
      "email": "",
      "scopes": [

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

 "id": "8061072881391620712",
 "name": "operation-1565289606387-58f9f62f5989c-e582f586-6d22f38d",
 "zone": "`PROJECT_ID`/zones/`ZONE`",
 "operationType": "insert",
 "targetLink": "`PROJECT_ID`/zones/`ZONE`/instances/`VM_NAME`",
 "targetId": "2977231178150564457",
 "status": "RUNNING",
 "user": "",
 "progress": 0,
 "insertTime": "2019-08-08T11:40:07.728-07:00",
 "startTime": "2019-08-08T11:40:07.731-07:00",
 "selfLink": "`PROJECT_ID`/zones/`ZONE`/operations/operation-1565289606387-58f9f62f5989c-e582f586-6d22f38d",
 "kind": "compute#operation"

What's next

  • Start using drest! :)