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
-
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
-
Make the file executable using the following command:
$ chmod a+x ./oapi-cli-x86_64.AppImage
-
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
. -
(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. |
-
Run the following commands in your terminal:
$ brew tap outscale/tap $ brew install outscale/tap/oapi-cli
-
You can now run oapi-cli as follows:
$ oapi-cli
Installing oapi-cli on Windows
-
Download oapi-cli-x86_64.zip and extract its content.
-
You can now run oapi-cli as follows:
$ oapi-cli.exe
Configuring oapi-cli
-
(Linux and macOS) In your home directory, create a directory named
.osc
. -
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
andSECRETKEY
are the access key ID and corresponding secret key of your account. For more information, see Creating an Access Key.
-
-
(Linux and macOS) Save this file in the .osc directory.
(Windows) Save this file in the same directory as oapi-cli.exe. -
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.
$ 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, |
Using Alternate Syntaxes
When sending requests using oapi-cli, different syntaxes are available. The following examples use the CreateTags call to illustrate complex arguments.
$ oapi-cli CreateTags \
--ResourceIds '["i-11111111", "i-22222222"]' \
--Tags '[{"Key": "key", "Value": "example1"}]'
$ oapi-cli CreateTags \
--ResourceIds '["i-11111111", "i-22222222"]' \
--Tags.0.Key key \
--Tags.0.Value example2
$ oapi-cli CreateTags \
--ResourceIds '["i-11111111", "i-22222222"]' \
--Tags.0.Key key ..Value example3
$ 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
|
Related Pages
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.