»kv
The kv
command groups subcommands for interacting with Vault's key/value
secrets engine (both K/V Version 1 and K/V
Version 2.
»Examples
Create or update the key named "creds" in the K/V Version 2 enabled at "secret" with the value "passcode=my-long-passcode":
$ vault kv put secret/creds passcode=my-long-passcode Key Value --- ----- created_time 2019-06-28T15:53:30.395814Z deletion_time n/a destroyed false version 1
$ vault kv put secret/creds passcode=my-long-passcodeKey Value--- -----created_time 2019-06-28T15:53:30.395814Zdeletion_time n/adestroyed falseversion 1
Read this value back:
$ vault kv get secret/creds ====== Metadata ====== Key Value --- ----- created_time 2019-06-28T15:53:30.395814Z deletion_time n/a destroyed false version 1 ====== Data ====== Key Value --- ----- passcode my-long-passcode
$ vault kv get secret/creds====== Metadata ======Key Value--- -----created_time 2019-06-28T15:53:30.395814Zdeletion_time n/adestroyed falseversion 1
====== Data ======Key Value--- -----passcode my-long-passcode
Get metadata for the key named "creds":
$ vault kv metadata get secret/creds ========== Metadata ========== Key Value --- ----- cas_required false created_time 2019-06-28T15:53:30.395814Z current_version 1 delete_version_after 0s max_versions 0 oldest_version 0 updated_time 2019-06-28T15:53:30.395814Z ====== Version 1 ====== Key Value --- ----- created_time 2019-06-28T15:53:30.395814Z deletion_time n/a destroyed false
$ vault kv metadata get secret/creds========== Metadata ==========Key Value--- -----cas_required falsecreated_time 2019-06-28T15:53:30.395814Zcurrent_version 1delete_version_after 0smax_versions 0oldest_version 0updated_time 2019-06-28T15:53:30.395814Z
====== Version 1 ======Key Value--- -----created_time 2019-06-28T15:53:30.395814Zdeletion_time n/adestroyed false
Get a specific version of the key named "creds":
$ vault kv get -version=1 secret/creds ====== Metadata ====== Key Value --- ----- created_time 2019-06-28T15:53:30.395814Z deletion_time n/a destroyed false version 1 ====== Data ====== Key Value --- ----- passcode my-long-passcode
$ vault kv get -version=1 secret/creds====== Metadata ======Key Value--- -----created_time 2019-06-28T15:53:30.395814Zdeletion_time n/adestroyed falseversion 1
====== Data ======Key Value--- -----passcode my-long-passcode
»Usage
Usage: vault kv <subcommand> [options] [args] # ... Subcommands: delete Deletes versions in the KV store destroy Permanently removes one or more versions in the KV store enable-versioning Turns on versioning for a KV store get Retrieves data from the KV store list List data or secrets metadata Interact with Vault's Key-Value storage patch Sets or updates data in the KV store without overwriting put Sets or updates data in the KV store rollback Rolls back to a previous version of data undelete Undeletes versions in the KV store
Usage: vault kv <subcommand> [options] [args]
# ...
Subcommands: delete Deletes versions in the KV store destroy Permanently removes one or more versions in the KV store enable-versioning Turns on versioning for a KV store get Retrieves data from the KV store list List data or secrets metadata Interact with Vault's Key-Value storage patch Sets or updates data in the KV store without overwriting put Sets or updates data in the KV store rollback Rolls back to a previous version of data undelete Undeletes versions in the KV store
For more information, examples, and usage about a subcommand, click on the name of the subcommand in the sidebar.