List all aliases in your Alibaba Cloud account for the current region using the API or Alibaba Cloud CLI.
Prerequisites
Before you begin, ensure that you have:
(For RAM users) A custom policy that grants the
kms:ListAliasespermission on the alias resource
Grant a RAM user permission to query aliases
To allow a RAM user to query aliases, attach a custom policy that grants the kms:ListAliases permission. The following example grants user 123456 permission to list aliases in the cn-hangzhou region:
{
"Version": "1",
"Statement": [
{
"Effect": "Allow",
"Action": [
"kms:ListAliases"
],
"Resource": [
"acs:kms:cn-hangzhou:123456:alias"
]
}
]
}Query aliases using the API
Call the ListAliases operation to list all aliases in the current region for your account.
Query aliases using the CLI
Run the following command to list all aliases:
aliyun kms ListAliases