Authorization for API calls

Updated at:
Copy as MD

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.

PolicyScope
AliyunBSSFullAccessFull access to all BSS OpenAPI operations
AliyunBSSReadOnlyAccessRead-only access to billing, orders, and account data
AliyunBSSOrderAccessOrder 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 nameDescriptionPermission action
QueryAccountBalanceQueries the balance of an account.bss:DescribeAcccount
QueryCashCouponsQueries the coupons of a user.bss:DescribeCoupons
QueryPrepaidCardsQueries the prepaid cards of a user.bss:DescrbePrepaidCards
QueryProductListQueries product information.bss:DescribeProduct
DescribePricingModuleQueries the information about product modules.bss:DescribeProduct
QueryPriceListQueries the account balance.bss:DescribeProduct
GetPayAsYouGoPriceQueries the price of a pay-as-you-go product.bss:DescribePrice
GetSubscriptionPriceQueries the price of a subscription product.bss:DescribePrice
QueryOrdersQueries a list of orders.bss:DescribeOrderList
GetOrderDetailQueries the details of an order.bss:DescribeOrderDetail
ModifyInstanceModifies an instance.bss:ModifyInstance
QueryAvailableInstancesQueries available instances.bss:DescribeInstances
CreateInstanceCreates an instance.bss:ModifyInstance
SetRenewalEnables auto-renewal for an instance.bss:ModifyPrepaidInstanceAutoRenew
RenewInstanceRenews an instance.bss:ModifyInstance
DescribeResourcePackageProductDescribes resource plan products.bss:DescribeProduct
GetResourcePackagePriceQueries the price of a resource plan.bss:DescribePrice
QueryResourcePackageInstancesQueries resource plan instances.bss:DescribeInstances
CreateResourcePackageCreates a resource plan.bss:ModifyInstance
QueryInstanceGaapCostQueries monthly cost allocation.bss:DescribeGaapBill
QueryBillOverviewQueries a bill overview.bss:DescribeBillList
QueryBillQueries bills.bss:DescribeBillList
QueryInstanceBillQueries instance bills.bss:DescribeBillList
SubscribeBillToOSSSubscribes to itemized bills delivered to OSS.bss:ModifySubscribeToOSS
UnsubscribeBillToOSSCancels a subscription to detailed bills.bss:ModifySubscribeToOSS
QueryAccountTransactionsQueries the transaction details of an account.bss:DescribeAcccountTran
CancelOrderCancels 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.