June 20-22 Announcing HashiConf Europe full schedule: keynotes, sessions, labs & more Register Now
  • Overview
    • Batch Processing Workloads
    • Edge Workload Management
    • Non-Containerized Application Orchestration
    • Simple Container Orchestration
  • Enterprise
  • Tutorials
  • Docs
  • API
  • Plugins
  • Tools
  • Community
GitHub—Stars on GitHub
Download
    • v1.3.x (latest)
    • v1.2.x
    • v1.1.x
    • v1.0.x
    • v0.12.x
    • v0.11.x
  • HTTP API Overview

  • Libraries & SDKs
  • JSON Jobs

  • ACL Policies
  • ACL Tokens
  • Agent
  • Allocations
  • Client
  • Deployments
  • Evaluations
  • Events
  • Jobs
  • Namespaces
  • Nodes
  • Metrics
    • Overview
    • Autopilot
    • Raft
    • License
    • Scheduler
    • Snapshot
  • Plugins
  • Quotas
  • Recommendations
  • Regions
  • Scaling Policies
  • Search
  • Sentinel Policies
  • Services
  • Status
  • System
  • UI
  • Validate
  • Volumes
Type '/' to Search

»Scaling Policies HTTP API

The /scaling/policies and /scaling/policy/ endpoints are used to list and view scaling policies.

»List Scaling Policies

This endpoint returns the scaling policies from all jobs.

MethodPathProduces
GET/scaling/policiesapplication/json

The table below shows this endpoint's support for blocking queries, consistency modes and required ACLs.

Blocking QueriesConsistency ModesACL Required
YESallnamespace:list-scaling-policies

»Parameters

  • job (string: "")- Specifies the job ID to filter policies by.

  • type (string: "") - Specifies the type of scaling policy to filter by. In the open source version of Nomad, horizontal is the only supported value. Within Nomad Enterprise, vertical_mem and vertical_cpu are supported along with vertical. The latter returns policies matching both vertical_mem and vertical_cpu.

»Sample Request

$ curl \
    https://localhost:4646/v1/scaling/policies
$ curl \
    https://localhost:4646/v1/scaling/policies
$ curl \
    https://localhost:4646/v1/scaling/policies?job=example
$ curl \
    https://localhost:4646/v1/scaling/policies?job=example
$ curl \
    https://localhost:4646/v1/scaling/policies?type=vertical
$ curl \
    https://localhost:4646/v1/scaling/policies?type=vertical

»Sample Response

[
  {
    "ID": "b2c64295-4315-2fdc-6158-a27156808729",
    "Enabled": true,
    "Type": "vertical_cpu",
    "Target": {
      "Namespace": "default",
      "Job": "example",
      "Group": "cache",
      "Task": "redis"
    },
    "CreateIndex": 1340,
    "ModifyIndex": 1340
  },
  {
    "ID": "c355d0ec-7aa1-2604-449d-4ec79c813d2c",
    "Enabled": true,
    "Type": "vertical_mem",
    "Target": {
      "Job": "example",
      "Group": "cache",
      "Task": "redis",
      "Namespace": "default"
    },
    "CreateIndex": 1340,
    "ModifyIndex": 1340
  },
  {
    "ID": "31a53813-24df-b2ad-77dc-1b4bad4e7dca",
    "Enabled": true,
    "Type": "horizontal",
    "Target": {
      "Job": "example",
      "Group": "cache",
      "Namespace": "default"
    },
    "CreateIndex": 1358,
    "ModifyIndex": 1358
  }
]
[
  {
    "ID": "b2c64295-4315-2fdc-6158-a27156808729",
    "Enabled": true,
    "Type": "vertical_cpu",
    "Target": {
      "Namespace": "default",
      "Job": "example",
      "Group": "cache",
      "Task": "redis"
    },
    "CreateIndex": 1340,
    "ModifyIndex": 1340
  },
  {
    "ID": "c355d0ec-7aa1-2604-449d-4ec79c813d2c",
    "Enabled": true,
    "Type": "vertical_mem",
    "Target": {
      "Job": "example",
      "Group": "cache",
      "Task": "redis",
      "Namespace": "default"
    },
    "CreateIndex": 1340,
    "ModifyIndex": 1340
  },
  {
    "ID": "31a53813-24df-b2ad-77dc-1b4bad4e7dca",
    "Enabled": true,
    "Type": "horizontal",
    "Target": {
      "Job": "example",
      "Group": "cache",
      "Namespace": "default"
    },
    "CreateIndex": 1358,
    "ModifyIndex": 1358
  }
]

»Read Scaling Policy

This endpoint reads a specific scaling policy.

MethodPathProduces
GET/scaling/policy/:policy_idapplication/json

The table below shows this endpoint's support for blocking queries, consistency modes and required ACLs.

Blocking QueriesConsistency ModesACL Required
YESallnamespace:read-scaling-policy

»Parameters

  • :policy_id (string: <required>) - Specifies the ID of the scaling policy (as returned by the scaling policy list endpoint). This is specified as part of the path.

»Sample Request

$ curl \
    https://localhost:4646/v1/scaling/policy/5e9f9ef2-5223-6d35-bac1-be0f3cb974ad
$ curl \
    https://localhost:4646/v1/scaling/policy/5e9f9ef2-5223-6d35-bac1-be0f3cb974ad

»Sample Response

{
  "CreateIndex": 10,
  "Enabled": true,
  "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad",
  "Type": "horizontal",
  "Max": 10,
  "Min": 0,
  "ModifyIndex": 10,
  "Policy": {
    "engage": true,
    "foo": "bar",
    "howdy": "doody",
    "value": 6.0
  },
  "Target": {
    "Group": "cache",
    "Job": "example",
    "Namespace": "default"
  }
}
{
  "CreateIndex": 10,
  "Enabled": true,
  "ID": "5e9f9ef2-5223-6d35-bac1-be0f3cb974ad",
  "Type": "horizontal",
  "Max": 10,
  "Min": 0,
  "ModifyIndex": 10,
  "Policy": {
    "engage": true,
    "foo": "bar",
    "howdy": "doody",
    "value": 6.0
  },
  "Target": {
    "Group": "cache",
    "Job": "example",
    "Namespace": "default"
  }
}
github logoEdit this page
DocsAPIResourcesPrivacySecurityPress KitConsent Manager