---
title: "ezgh keys policy put"
description: "Replace a key's 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 keys policy put

{/* 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 keys policy put <key> --file policy.json [--etag e] [flags]
```

Replace a key's policy with a JSON document, from `--file`, or stdin with `--file` -. The change applies only if the key hasn't changed since `--etag`, so a save can't erase someone else's. The ETag is the key's, not the policy's: an alias write, a rename, a disable or a scheduled rotation moves it too. Without `--etag`, ezgh reads the current ETag just before saving; to protect a whole read, edit and save, pass the one `ezgh keys policy get` or `ezgh keys get` printed. A document that wouldn't let you change it again is refused.

Part of [`ezgh keys policy`](/cli/reference/keys-policy).

## Examples

```sh
ezgh keys policy put kms_… --file policy.json --etag '"0199…"'
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--etag` | string |  | the key's ETag when it was read |
| `--file` | string |  | the policy document, or - for stdin |

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

Source: https://docs.ezghcloud.com/cli/reference/keys-policy-put/index.mdx
