Command modes in CloudHSM CLI - AWS CloudHSM

Command modes in CloudHSM CLI

In CloudHSM CLI, you can run commands two different ways: in single command mode and interactive mode. Interactive mode is designed for users, and single command mode is designed for scripts.

Note

All commands work in interactive mode and single command mode.

Interactive mode

Use the following commands to start CloudHSM CLI interactive mode

Linux
$ /opt/cloudhsm/bin/cloudhsm-cli interactive
Windows
C:\Program Files\Amazon\CloudHSM\bin\> .\cloudhsm-cli.exe interactive

When using the CLI in Interactive Mode, you can log in to a user account using the login command.

To list all CloudHSM CLI commands, run the following command:

aws-cloudhsm > help

To get the syntax for a CloudHSM CLI command, run the following command:

aws-cloudhsm > help <command-name>

To get a list of users on the HSMs, enter user list.

aws-cloudhsm > user list

To end your CloudHSM CLI session, run the following command:

aws-cloudhsm > quit

Single Command mode

If you run CloudHSM CLI using Single Command Mode, you need to set two environment variables to provide credentials: CLOUDHSM_PIN and CLOUDHSM_ROLE:

$ export CLOUDHSM_ROLE=admin
$ export CLOUDHSM_PIN=admin_username:admin_password

After doing this, you can execute commands using the credentials stored in your environment.

$ cloudhsm-cli user change-password --username alice --role crypto-user Enter password: Confirm password: { "error_code": 0, "data": { "username": "alice", "role": "crypto-user" } }