Install and configure the new SLS CLI

Updated at:

Install the new Simple Log Service (SLS) command-line interface (CLI), and then configure the credentials, region, and language settings that the CLI requires to access Alibaba Cloud resources. Complete the configuration before you use the CLI.

Install the new SLS CLI

Method 1: Install by using Homebrew (macOS)

brew install aliyun-cli
aliyun plugin install --names sls

Method 2: Install by using a script (Linux and macOS)

sudo /bin/bash -c "$(curl -fsSL https://aliyuncli.alicdn.com/install.sh)"
aliyun plugin install --names sls
Note

This method requires sudo privileges. The CLI is installed to /usr/local/bin/aliyun.

For more installation methods, see Install, update, and uninstall Alibaba Cloud CLI.

Verify the installation

Run the following commands to verify that the installation is successful:

aliyun version
aliyun sls version

Expected output:

aliyun-cli-sls 0.1.4 (5e628xxxx)

Configure credentials

Configure an AccessKey pair

Make sure that your credential information is accurate. Inaccurate credentials cause unintended operations or failed API calls, which can cause unnecessary losses. The Alibaba Cloud CLI provides two configuration modes: interactive and non-interactive. Interactive configuration guides you through the process, so you can configure credentials quickly with little learning effort. The following example uses an AccessKey pair:

# 1. Interactive configuration
aliyun configure

# 2. Non-interactive configuration
aliyun configure set \
  --access-key-id <AccessKey-ID> \
  --access-key-secret <AccessKey-Secret> \
  --region <Region-ID>

The following table describes the parameters of the non-interactive command:

ParameterDescriptionExample
--access-key-idThe AccessKey ID of your Alibaba Cloud account.LTAI5t...
--access-key-secretThe AccessKey Secret of your Alibaba Cloud account.Xg7vGZ...
--regionThe region ID.cn-hangzhou

Other authentication methods

To use another authentication method, such as StsToken, RamRoleArn, or EcsRamRole, see Configure and manage credentials.

View help information

To view all API operations that the new SLS CLI supports, run the following command:

aliyun help sls

To view the help information for a specific API operation, run the following command:

aliyun help sls <api-name>