Cli

CLI Reference for Aliases

View as Markdown

AIS CLI supports user-defined aliases, similar to the Unix alias command. Defining your own alias for an existing command can make the AIS CLI more intuitive and efficient to use.

Auto-complete options also hold for the alias you create!

The current set of default aliases (which you may also redefine or remove at any time) includes:

1$ ais alias
2ALIAS COMMAND
3===== =======
4cp bucket cp
5create bucket create
6evict bucket evict
7ls bucket ls
8rmb bucket rm
9start job start
10blob-download job start blob-download
11download job start download
12dsort job start dsort
13stop job stop
14wait job wait
15get object get
16prefetch object prefetch
17put object put
18rmo object rm
19space-cleanup storage cleanup
20scrub storage validate

Table of Contents

Create an Alias

ais alias set ALIAS AIS_COMMAND

Create an alias “ALIAS” for existing AIS_COMMAND.

Note: ALIAS must be a single word, or multiple words connected with - (hyphen) or _ (underscore). The arguments following ALIAS constitute the full ais command. The ais command can be put inside quotes for readability.

For example, ais alias set show-clu show cluster and ais alias set show-clu "show cluster" create the same alias for show cluster.

Examples

1$ ais alias sc "show cluster"
2Aliased "show cluster"="sc"
3
4$ ais sc
5PROXY MEM USED % MEM AVAIL UPTIME
6IWOup8082 0.25% 15.43GiB 24h
7Kflkp8083 0.25% 15.43GiB 24h
8xqfwp8081 0.25% 15.43GiB 24h
9hJzRp8084 0.26% 15.43GiB 24h
10WSLop8080[P] 0.29% 15.43GiB 24h
11
12TARGET MEM USED % MEM AVAIL CAP USED % CAP AVAIL CPU USED % REBALANCE UPTIME
13ejpCt8086 0.38% 15.43GiB 14.00% 1.951TiB 0.12% - 24h
14CASGt8088 0.35% 15.43GiB 14.00% 1.951TiB 0.11% - 24h
15xZntt8087 0.36% 15.43GiB 14.00% 1.951TiB 0.11% - 24h
16Hwbmt8085 0.31% 15.43GiB 14.00% 1.951TiB 0.12% - 24h
17DMwvt8089 0.37% 15.43GiB 14.00% 1.951TiB 0.11% - 24h
18
19Summary:
20 Proxies: 5 (0 unelectable)
21 Targets: 5
22 Primary Proxy: WSLop8080
23 Smap Version: 43
24 Deployment: dev
25
26$ ais sc CASGt8088
27TARGET MEM USED % MEM AVAIL CAP USED % CAP AVAIL CPU USED % REBALANCE UPTIME DEPLOYMENT STATUS
28CASGt8088 0.35% 15.43GiB 14.00% 1.951TiB 0.11% - 24h dev online

Remove Alias

ais alias rm ALIAS

Removes existing alias “ALIAS”.

Examples

1$ ais alias
2ALIAS COMMAND
3get object get
4ls bucket ls
5put object put
6sc show cluster
7
8$ ais alias rm sc
9
10$ ais alias
11ALIAS COMMAND
12get object get
13ls bucket ls
14put object put

List Aliases

ais alias show or ais alias

List all created aliases. ais alias with no arguments lists all previously added aliases — the same behavior you expect from Unix shell alias.

Note that aliases are also shown in the app-level help message (ais -h).

Examples

List aliases

1$ ais alias
2ALIAS COMMAND
3get object get
4ls bucket ls
5put object put
6
7$ ais alias set sc "show cluster"
8Aliased "sc"="show cluster"
9
10$ ais alias
11ALIAS COMMAND
12get object get
13ls bucket ls
14put object put
15sc show cluster

View aliases from app-level help

1$ ais -h
2 0.8 (build 30bf97129)
3
4DESCRIPTION:
5 If [Tab] completion doesn't work:
6 * download https://github.com/NVIDIA/aistore/tree/main/cmd/cli/autocomplete
7 * run 'cmd/cli/autocomplete/install.sh'
8 For more information, please refer to https://github.com/NVIDIA/aistore/blob/main/cmd/cli/README.md
9
10COMMANDS:
11 bucket create/destroy buckets, list bucket's content, show existing buckets and their properties
12 object put, get, rename, remove, and other operations on objects
13 cluster monitor and manage AIS cluster: add/remove nodes, change primary gateway, etc.
14 config set local/global AIS cluster configurations
15 etl execute custom transformations on objects
16 job query and manage jobs (aka extended actions or xactions)
17 auth add/remove/show users, manage user roles, manage access to remote clusters
18 show show information about buckets, jobs, all other managed entities in the cluster and the cluster itself
19 help show a list of commands; show help for a given command
20 advanced special commands intended for development and advanced usage
21 storage monitor and manage clustered storage
22 archive Create archive and append files to archive
23 log show log
24 rebalance show rebalance details
25 remote-cluster show attached AIS clusters
26 alias manage top-level aliases
27 kubectl show kubernetes pods and services
28 search search ais commands
29
30 ALIASES:
31 get (alias for "object get") get object from the specified bucket
32 put (alias for "object put") put object(s) into the specified bucket
33 ls (alias for "bucket ls") list buckets and their objects
34
35GLOBAL OPTIONS:
36 --help, -h show help
37 --no-color disable colored output
38 --version, -V print only the version

Reset Aliases

ais alias reset

Clear all created aliases, and only keep the defaults.

Example

1$ ais alias
2ALIAS COMMAND
3get object get
4ls bucket ls
5put object put
6sc show cluster
7
8$ ais alias reset
9Aliases reset to default
10
11$ ais alias
12ALIAS COMMAND
13get object get
14ls bucket ls
15put object put

Alias Configuration File

As with other CLI configurations, aliases are stored in the CLI config file.

All aliases are stored under "aliases" as a map of strings (ALIAS to AIS_COMMAND).

1// cat ~/.config/ais/cli/cli.json
2{
3 "cluster": {
4 "url": "http://127.0.0.1:8080",
5 "default_ais_host": "http://127.0.0.1:8080",
6 "default_docker_host": "http://172.50.0.2:8080",
7 "skip_verify_crt": false
8 },
9 "timeout": {
10 "tcp_timeout": "60s",
11 "http_timeout": "0s"
12 },
13 "auth": {
14 "url": "http://127.0.0.1:52001"
15 },
16 "aliases": {
17 "sc": "show cluster",
18 "create": "create buckets"
19 }
20}

Users can manually add aliases to the config file, but all commands must follow the rules for creating an alias. E.g., aliases:

1 "show clu": "show cluster",
2 "show-clu": "show kluster",

are ignored because the name of the first one is not a single (or hyphenated ) word, while the AIS command of the second one does not exist.