---
title: "ezgh hosted-queues policies create"
description: "Create a policy."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.ezghcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ezgh hosted-queues policies create

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh hosted-queues policies create <cluster> <name> --pattern re --definition json [--apply-to t] [--priority n] [--vhost v] [--wait] [flags]
```

Create a policy: `--definition` is a JSON object of max-length, max-length-bytes, message-ttl, expires, overflow, dead-letter-exchange, dead-letter-routing-key, delivery-limit or queue-leader-locator.

Part of [`ezgh hosted-queues policies`](/cli/reference/hosted-queues-policies).

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--apply-to` | string |  | all, queues, exchanges, classic_queues, quorum_queues or streams |
| `--definition` | string |  | a JSON object, such as &#123;"max-length": 10000&#125; |
| `--pattern` | string |  | the regular expression of the names it applies to |
| `--priority` | int |  | 0 to 999; the highest matching policy applies |
| `--vhost` | string | `/` | the vhost it's in (/ is the default vhost) |
| `--wait` | boolean |  | wait until it's done |
| `--wait-timeout` | duration | `10m0s` | how long `--wait` waits |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/hosted-queues-policies-create/index.mdx
