VAULT-ASSOCIATE-002 · Question #59
Which command will generate a new transit key?
The correct answer is C. vault write -f transit/keys/my-key. To generate a new encryption key within the Vault Transit secrets engine, the vault write command must be used, typically with the -f flag for force, to create a new key at a specified path.
Question
Options
- Avault put transit/keys/my-key
- Cvault write -f transit/keys/my-key
- Dvault create transit/keys/my-key
How the community answered
(61 responses)- A5% (3)
- C93% (57)
- D2% (1)
Why each option
To generate a new encryption key within the Vault Transit secrets engine, the `vault write` command must be used, typically with the `-f` flag for force, to create a new key at a specified path.
`vault put` is not a standard Vault CLI command for creating resources like Transit keys; `vault write` is the primary command for such operations.
The correct command to create a new named encryption key in the Transit secrets engine is `vault write -f transit/keys/my-key`. The `vault write` command is used for writing data to a path, and for creating keys, the `-f` (force) flag is often used when no payload is explicitly provided to confirm creation.
`vault create` is not a standard Vault CLI command for creating keys; `vault write` is the correct verb for this action.
Concept tested: Vault Transit engine key creation
Source: https://developer.hashicorp.com/vault/api-docs/secrets/transit#create-update-key
Topics
Community Discussion
No community discussion yet for this question.