Authorization for API calls
Before a Resource Access Management (RAM) user can call BSS APIs, the Alibaba Cloud account owner must grant the appropriate permissions to the user.
Grant permissions to a RAM user
BSS OpenAPI supports three managed access policies. Start with the managed policy that best fits the scope required, then refine with a custom policy if needed.
| Policy | Scope |
|---|---|
AliyunBSSFullAccess | Full access to all BSS OpenAPI operations |
AliyunBSSReadOnlyAccess | Read-only access to billing, orders, and account data |
AliyunBSSOrderAccess | Order management operations only |
To attach a managed policy to a RAM user, see Grant permissions to a RAM user.
Create a custom policy
For more granular control, create a custom policy using BSS OpenAPI permission points. The permission format is bssapi:<APIName>, for example, bssapi:QueryInstanceBill.
The following policy allows a RAM user to query instance bills:
{
"Version": 1,
"Statement": [
{
"Action": [
"bssapi:QueryInstanceBill"
],
"Resource": "*",
"Effect": "Allow"
}
]
}The resource for all BSS OpenAPI permissions is *.For the policy syntax reference, see Policy structure and syntax.
Console-compatible permission points
BSS OpenAPI also accepts the bss:<ActionName> format for compatibility with console permissions. For example, replacing bssapi:QueryInstanceBill with bss:DescribeBillList in the policy above produces the same result.
The following table maps each API to its corresponding console-compatible permission action.
| API name | Description | Permission action |
|---|---|---|
| QueryAccountBalance | Queries the balance of an account. | bss:DescribeAcccount |
| QueryCashCoupons | Queries the coupons of a user. | bss:DescribeCoupons |
| QueryPrepaidCards | Queries the prepaid cards of a user. | bss:DescrbePrepaidCards |
| QueryProductList | Queries product information. | bss:DescribeProduct |
| DescribePricingModule | Queries the information about product modules. | bss:DescribeProduct |
| QueryPriceList | Queries the account balance. | bss:DescribeProduct |
| GetPayAsYouGoPrice | Queries the price of a pay-as-you-go product. | bss:DescribePrice |
| GetSubscriptionPrice | Queries the price of a subscription product. | bss:DescribePrice |
| QueryOrders | Queries a list of orders. | bss:DescribeOrderList |
| GetOrderDetail | Queries the details of an order. | bss:DescribeOrderDetail |
| ModifyInstance | Modifies an instance. | bss:ModifyInstance |
| QueryAvailableInstances | Queries available instances. | bss:DescribeInstances |
| CreateInstance | Creates an instance. | bss:ModifyInstance |
| SetRenewal | Enables auto-renewal for an instance. | bss:ModifyPrepaidInstanceAutoRenew |
| RenewInstance | Renews an instance. | bss:ModifyInstance |
| DescribeResourcePackageProduct | Describes resource plan products. | bss:DescribeProduct |
| GetResourcePackagePrice | Queries the price of a resource plan. | bss:DescribePrice |
| QueryResourcePackageInstances | Queries resource plan instances. | bss:DescribeInstances |
| CreateResourcePackage | Creates a resource plan. | bss:ModifyInstance |
| QueryInstanceGaapCost | Queries monthly cost allocation. | bss:DescribeGaapBill |
| QueryBillOverview | Queries a bill overview. | bss:DescribeBillList |
| QueryBill | Queries bills. | bss:DescribeBillList |
| QueryInstanceBill | Queries instance bills. | bss:DescribeBillList |
| SubscribeBillToOSS | Subscribes to itemized bills delivered to OSS. | bss:ModifySubscribeToOSS |
| UnsubscribeBillToOSS | Cancels a subscription to detailed bills. | bss:ModifySubscribeToOSS |
| QueryAccountTransactions | Queries the transaction details of an account. | bss:DescribeAcccountTran |
| CancelOrder | Cancels an unpaid order. | bss:CancelOrder |
Set product-specific permissions
To restrict a RAM user or user group to managing only the instances or bills of a specific cloud product, add a Condition block to the policy. When the user calls an API, the request must satisfy the ProductCode and ProductType conditions in the policy.
The following policy allows querying orders only where ProductCode is rds and ProductType is rords or bards:
{
"Version": 1,
"Statement": [
{
"Effect": "Allow",
"Action": [
"bssapi:QueryOrders"
],
"Resource": [
"*"
],
"Condition": {
"StringEquals": {
"bssapi:ProductCode": "rds",
"bssapi:ProductType": [
"rords",
"bards"
]
}
}
}
]
}Replace rds, rords, and bards with the ProductCode and ProductType values for the cloud product you want to restrict access to.