2017-09-08 02:11:11 +00:00
|
|
|
---
|
2020-01-18 00:18:09 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: policy write - Command
|
|
|
|
sidebar_title: <code>write</code>
|
2017-09-08 02:11:11 +00:00
|
|
|
description: |-
|
|
|
|
The "policy write" command uploads a policy with name NAME from the contents
|
|
|
|
of a local file PATH or stdin. If PATH is "-", the policy is read from stdin.
|
|
|
|
Otherwise, it is loaded from the file at the given path on the local disk.
|
|
|
|
---
|
|
|
|
|
|
|
|
# policy write
|
|
|
|
|
|
|
|
The `policy write` command uploads a policy with name NAME from the contents of
|
|
|
|
a local file PATH or stdin. If PATH is "-", the policy is read from stdin.
|
|
|
|
Otherwise, it is loaded from the file at the given path on the local disk.
|
|
|
|
|
|
|
|
For details on the policy syntax, please see the [policy
|
2020-01-22 20:05:41 +00:00
|
|
|
documentation](/docs/concepts/policies).
|
2017-09-08 02:11:11 +00:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Upload a policy named "my-policy" from "/tmp/policy.hcl" on the local disk:
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
```shell-session
|
2017-09-08 02:11:11 +00:00
|
|
|
$ vault policy write my-policy /tmp/policy.hcl
|
|
|
|
```
|
|
|
|
|
|
|
|
Upload a policy from stdin:
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
```shell-session
|
2017-09-08 02:11:11 +00:00
|
|
|
$ cat my-policy.hcl | vault policy write my-policy -
|
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2020-01-22 20:05:41 +00:00
|
|
|
There are no flags beyond the [standard set of flags](/docs/commands)
|
2017-09-08 02:11:11 +00:00
|
|
|
included on all commands.
|