How to update a credential

See also:

The update-credential command can be used to update an existing credential either interactively or by reading the contents of a YAML file.

The command behaves in the same fashion as the other credential-related commands; when the command is run, the Juju client will prompt you to select whether you want to update the credential stored in the local client, the currently active controller or both.

For example, the following command will read a file called mycreds.yaml and use it to update the credentials for the aws cloud:

juju update-credential aws -f mycreds.yaml

More specifically, Juju will first read the credentials from the provided file and then proceed to overwrite the contents of any existing credentials for the specified cloud (aws in this example) whose names match the ones in the file.

If you wish to update the credential either for the local Juju client or the active controller, you can include the --client or the --controller flags when running the above command. In this case, the prompt for selecting the target for the update operation will be bypassed.

When updating a credential stored in a controller, Juju first runs a set of sanity checks to ensure that the new credential contents can authenticate with the backing cloud and that any machines that may reside within a model currently related to the credential remain accessible. These tests can be bypassed by running the update-credentials command with the --force flag.

Last updated 4 months ago.