Vault
Read versioned key/value data
Read versioned data from an existing data path in the kv
v2 plugin.
Assumptions
- You have set up a
kv
v2 plugin. - Your authentication token has
read
permissions for thekv
v2 plugin.
Use vault kv get
to read all the current
key/value pairs on the given path:
$ vault kv get \
-cas <target_version> \
-mount <mount_path> \
<secret_path>
For example:
$ vault kv get -mount shared dev/square-api
======= Secret Path =======
shared/data/dev/square-api
======= Metadata =======
Key Value
--- -----
created_time 2024-11-13T21:58:32.128442898Z
custom_metadata <nil>
deletion_time n/a
destroyed false
version 3
===== Data =====
Key Value
--- -----
prod 5678
sandbox 1234
Use the -field
flag to target specific key value pairs on the given path:
$ vault kv get \
-mount <mount_path> \
-field <field_name> \
<secret_path>
For example:
$ vault kv get -mount shared -field prod dev/square-api
5678