Installing and Configuring oapi-cli

You can manage your resources on the OUTSCALE Cloud using oapi-cli, a command-line interface (CLI) developed by 3DS OUTSCALE.

oapi-cli is compatible with the OUTSCALE API exclusively. It is the successor to OSC CLI, with expanded features and improved user experience. For more information, see Comparison Between OSC CLI and oapi-cli.

You can also use Cockpit, OSC CLI, or AWS CLI. For more information, see About Cockpit, Installing and Configuring OSC CLI, and Installing and Configuring AWS CLI.

Installing oapi-cli

Installing oapi-cli on Linux

  1. Download the oapi-cli-x86_64.AppImage file using the following command:

    $ curl -LO https://github.com/outscale/oapi-cli/releases/download/nightly-linux/oapi-cli-x86_64.AppImage
  2. Make the file executable using the following command:

    $ chmod a+x ./oapi-cli-x86_64.AppImage
  3. You can now run oapi-cli as follows:

    $ ./oapi-cli-x86_64.AppImage

    If you encounter a fuse error, install fuse.

    If you can’t install fuse, run oapi-cli-x86_64.AppImage with the --appimage-extract-and-run option:

    $ ./oapi-cli-x86_64.AppImage --appimage-extract-and-run ReadImages

    This will extract the file’s content in a temporary directory and execute it. Note that using this method is a lot slower than using fuse.

  4. (optional) To make oapi-cli available for all users, move the file as follows:

    $ sudo mv oapi-cli-x86_64.AppImage /usr/local/bin/oapi-cli

Installing oapi-cli on macOS

Before you begin: Install Homebrew on your machine.

  1. Run the following commands in your terminal:

    $ brew tap outscale/tap
    $ brew install outscale/tap/oapi-cli
  2. You can now run oapi-cli as follows:

    $ oapi-cli

Installing oapi-cli on Windows

  1. Download oapi-cli-x86_64.zip and extract its content.

  2. You can now run oapi-cli as follows:

    $ oapi-cli.exe

Configuring oapi-cli

  1. (Linux and macOS) In your home directory, create a directory named .osc.

  2. Create a file named config.json with the following content:

    {
        "default": {
            "access_key": "ACCESSKEY",
            "secret_key": "SECRETKEY",
            "region": "eu-west-2"
        }
    }

    where:

    • eu-west-2 is the Region of your account.

    • ACCESSKEY and SECRETKEY are the access key ID and corresponding secret key of your account. For more information, see Creating an Access Key.

  3. (Linux and macOS) Save this file in the .osc directory.
    (Windows) Save this file in the same directory as oapi-cli.exe.

  4. You can now execute API calls using oapi-cli.

For more advanced configuration options, see the oapi-cli GitHub repository.

Using oapi-cli

To send a request using oapi-cli, specify in your command:

  • The call you request.

  • Any other option required by the command.

Request sample
$ oapi-cli CreateVolume \
   --SubregionName eu-west-2a \
   --Size 10

With OSC CLI, you must specify the name of the API in your command (for example, api or fcu). This is not needed with oapi-cli, since oapi-cli is only compatible with the OUTSCALE API.

Using Alternate Syntaxes

When sending requests using oapi-cli, different syntaxes are available. The following examples use the CreateTags call to illustrate complex arguments.

Syntax similar to OSC CLI
$ oapi-cli CreateTags \
    --ResourceIds '["i-11111111", "i-22222222"]'  \
    --Tags '[{"Key": "key", "Value": "example1"}]'
Alternate syntax for nested parameters
$ oapi-cli CreateTags \
    --ResourceIds '["i-11111111", "i-22222222"]' \
    --Tags.0.Key key \
    --Tags.0.Value example2
Cascade notation for nested parameters
$ oapi-cli CreateTags \
    --ResourceIds '["i-11111111", "i-22222222"]' \
    --Tags.0.Key key ..Value example3
Brackets notation for arrays
$ oapi-cli CreateTags \
    --ResourceIds[] "i-11111111" \
    --ResourceIds[] "i-22222222"  \
    --Tags.0.Key key ..Value example4

To execute a command using the brackets notation, some shells (like zsh) require the addition of quotes around the option.

Request example
$ oapi-cli CreateTags \
    "--ResourceIds[]" "i-11111111" \
    "--Tags.0.Key" key ..Value example4

Related Pages

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.