The MAAS CLI can do everything that the web UI can do, and more. The CLI uses the maas command exclusively which, in turn, connects to the API.

This page explains what is needed to get going with the CLI. Tasks are then separated into common, image management, and advanced.

Note that we do not provide complete coverage of the MAAS CLI. For an exhaustive treatment, see the API documentation.

Values are represented as uppercase variables preceded with the '$' character (e.g. $PROFILE and $EMAIL_ADDRESS). These are to be replaced with actual values.

Create an administrator

MAAS requires an initial administrator, sometimes called a MAAS "superuser". When the web UI is accessed for the first time you will be prompted to create this user:

sudo maas createadmin --username=$PROFILE --email=$EMAIL_ADDRESS

Extra administrators can be created in the same way. See here for creating regular users with the CLI.

Log in (required)

To use the CLI you must first log in to the API server.

You will need the API key that was generated when your MAAS account was created. To obtain it, run this command on the region controller (i.e. where the 'maas-region-controller' package was installed):

sudo maas-region apikey --username=$USERNAME


Log in with either of:



  • The terms 'username' and 'profile' are effectively equivalent.
  • The API server is the region controller.
  • If the API key is not supplied (in the first form) the user will be prompted for it.

For example, to log in with the account whose username is 'admin' and where the region controller is on the localhost:

maas login admin http://localhost:5240/MAAS/api/2.0

Get help

To access command help:

maas $PROFILE -h

Further examples:

maas $PROFILE tags -h
maas $PROFILE tags read -h

Log out

Once you are done with the CLI you can log out from the given profile, flushing the stored credentials.

maas logout $PROFILE

Next steps

To continue with the CLI, explore the following areas: