saectl (Serverless Application Engine Control Tool) is a command-line interface for deploying and managing applications on SAE. This guide walks you through installing saectl, configuring credentials, and enabling shell autocompletion.
Prerequisites
Before you begin, make sure you have:
An activated Serverless Application Engine (SAE) account with the required permissions. See Preparations for details.
An AccessKey ID and AccessKey secret. See Create an AccessKey pair.
Install saectl
Download the package for your operating system and architecture, then move the binary to your PATH.
macOS
Download
| Architecture | Package |
|---|---|
| x86-64 | saectl-v0.1.10-darwin-amd64.tar.gz |
| ARM64 | saectl-v0.1.10-darwin-arm64.tar.gz |
Install
Decompress the downloaded package. The decompressed directory contains
saectl.Move the binary to your system tools path:
mv ./saectl /usr/local/bin
Linux
Download
| Architecture | Package |
|---|---|
| x86-64 | saectl-v0.1.10-linux-amd64.tar.gz |
| ARM64 | saectl-v0.1.10-linux-arm64.tar.gz |
Install
Decompress the downloaded package:
tar -zxvf <package-file-name>The decompressed directory contains
saectl.Move the binary to your system tools path:
mv ./saectl /usr/local/bin
Windows
Download
| Architecture | Package |
|---|---|
| x86-64 | saectl-v0.1.10-windows-amd64.zip |
| ARM64 | saectl-v0.1.10-windows-arm64.zip |
Install
Decompress the downloaded package. The decompressed directory contains
saectl.exe.Add the decompressed directory path to the
PATHsystem environment variable.
Verify the installation
Run the following command:
saectl versionIf the command returns the version information for the saectl tool, the tool is installed successfully.
Get help
Use the --help flag with any command to see available options:
saectl --help— lists available commands such asget,describe, andapplysaectl apply --help— lists parameters for theapplycommand, such as-fand-o
Release notes
Configure saectl
saectl requires three environment variables to manage SAE resources: your AccessKey ID, AccessKey secret, and application deployment region.
| Variable | Description | Example |
|---|---|---|
ALICLOUD_ACCESS_KEY | Your AccessKey ID | LTAI5tXxx... |
ALICLOUD_SECRET_KEY | Your AccessKey secret | xXxXxXx... |
ALICLOUD_REGION | Your application deployment region | cn-beijing |
Linux or macOS
Run echo $SHELL to check your default shell, then follow the steps for your shell.
Zsh
Append the environment variables to
~/.zshrc:echo "export ALICLOUD_ACCESS_KEY='YOUR_ACCESS_KEY_ID'" >> ~/.zshrc echo "export ALICLOUD_SECRET_KEY='YOUR_ACCESS_KEY_SECRET'" >> ~/.zshrc echo "export ALICLOUD_REGION='cn-beijing'" >> ~/.zshrcReplace
YOUR_ACCESS_KEY_ID,YOUR_ACCESS_KEY_SECRET, andcn-beijingwith your actual values.Apply the changes:
source ~/.zshrcOpen a new terminal window and verify the variables are set:
echo $ALICLOUD_ACCESS_KEY, $ALICLOUD_SECRET_KEY, $ALICLOUD_REGION
Bash
Append the environment variables to
~/.bashrc:echo "export ALICLOUD_ACCESS_KEY='YOUR_ACCESS_KEY_ID'" >> ~/.bashrc echo "export ALICLOUD_SECRET_KEY='YOUR_ACCESS_KEY_SECRET'" >> ~/.bashrc echo "export ALICLOUD_REGION='cn-beijing'" >> ~/.bashrcReplace
YOUR_ACCESS_KEY_ID,YOUR_ACCESS_KEY_SECRET, andcn-beijingwith your actual values.Apply the changes:
source ~/.bashrcOpen a new terminal window and verify the variables are set:
echo $ALICLOUD_ACCESS_KEY, $ALICLOUD_SECRET_KEY, $ALICLOUD_REGION
Windows
This example uses Command Prompt (CMD).
Run the following commands:
setx ALICLOUD_ACCESS_KEY "YOUR_ACCESS_KEY_ID" setx ALICLOUD_SECRET_KEY "YOUR_ACCESS_KEY_SECRET" setx ALICLOUD_REGION "cn-beijing"Replace
YOUR_ACCESS_KEY_ID,YOUR_ACCESS_KEY_SECRET, andcn-beijingwith your actual values.Open a new Command Prompt window and verify the variables are set:
echo %ALICLOUD_ACCESS_KEY%, %ALICLOUD_SECRET_KEY%, %ALICLOUD_REGION%
Verify the configuration
Run the following command:
saectl get nsIf the command returns the namespace information for the specified application deployment region in your account, the saectl tool is configured successfully.
Set up shell autocompletion
saectl supports autocompletion for Bash, Zsh, Fish, and PowerShell. After setup, press Tab to complete commands, resource types, resource names, and parameters.
Install autocompletion
Bash
# Generate the completion script
saectl completion bash > ~/.saectl-completion.bash
# Add it to .bashrc
echo 'source ~/.saectl-completion.bash' >> ~/.bashrc
# Apply the changes immediately
source ~/.bashrcThe default Bash on macOS is outdated. Use Zsh, or upgrade Bash with Homebrew:
brew install bash-completion@2
saectl completion bash > $(brew --prefix)/etc/bash_completion.d/saectlZsh
# Generate the completion script
saectl completion bash > ~/.saectl-completion.bash
# Add it to .zshrc (using bashcompinit compatibility mode)
cat >> ~/.zshrc << 'EOF'
autoload -U +X bashcompinit && bashcompinit
source ~/.saectl-completion.bash
EOF
# Apply the changes immediately
source ~/.zshrcFish
# Generate the completion script (takes effect automatically)
saectl completion fish > ~/.config/fish/completions/saectl.fishPowerShell
# Generate the completion script
saectl completion powershell | Out-String | Invoke-Expression
# Add it to your profile to make it permanent
saectl completion powershell >> $PROFILEUse autocompletion
After installation, enter saectl in the terminal and press Tab to trigger autocompletion. The following completions are supported:
| Type | How to trigger | Examples |
|---|---|---|
| Commands | saectl + Tab | get, create, delete, apply, describe, logs, exec |
| Resource types | saectl get + Tab | namespaces, deployments, pods, services, configmaps, secrets, ingresses |
| Resource names | After a resource type, press Tab | Specific resource names in the current namespace |
| Parameters | -- + Tab | --namespace, --output, --all-namespaces, --selector |
| Container names | When using logs or exec, press Tab | Container names in the pod |
Troubleshoot autocompletion
If autocompletion is not working, purge the completion cache:
# Zsh
rm -f ~/.zcompdump*
exec zsh
# Bash
hash -rRemove autocompletion
Bash: Delete
~/.saectl-completion.bashand remove thesourceline from~/.bashrc.Zsh: Delete
~/.saectl-completion.bashand remove the related lines from~/.zshrc.Fish: Delete
~/.config/fish/completions/saectl.fish.