Vault – cli

Reading Time: < 1 minute

Last Updated: 5/19/2024

Please remember if you are using the CLI you are going to want to set the API ENDPOINT value..

examples:

export VAULT_ADDR=http://172.16.105.11:8200/

Next, you are going to want to authenticate to the vault.

root@node1:/home/ubuntu# vault login
Token (will be hidden):
Success! You are now authenticated. The token information displayed below
is already stored in the token helper. You do NOT need to run "vault login"
again. Future Vault requests will automatically use this token.

Key                  Value
---                  -----
token                hvs.qybmrPNEqiouqDN4DzFWwekp
token_accessor       F1sb1oHXFeWV7KdnPfULIFib
token_duration
token_renewable      false
token_policies       ["root"]
identity_policies    []
policies             ["root"]

info

vault help

info

root@node1:/home/ubuntu# vault kv put secret/password value=test
==== Secret Path ====
secret/data/password

======= Metadata =======
Key                Value
---                -----
created_time       2024-05-19T16:37:08.807459777Z
custom_metadata    <nil>
deletion_time      n/a
destroyed          false
version            1

Let’s retrieve a value

root@node1:/home/ubuntu# vault kv get secret/password
==== Secret Path ====
secret/data/password

======= Metadata =======
Key                Value
---                -----
created_time       2024-05-19T16:37:08.807459777Z
custom_metadata    <nil>
deletion_time      n/a
destroyed          false
version            1

==== Data ====
Key      Value
---      -----
value    test
This entry was posted in Secrets, Vault. Bookmark the permalink.