This topic provides an example on how to call an operation to query the specifications of Anti-DDoS Proxy.
View API documentation
To query the specifications of Anti-DDoS Proxy instances, call the DescribeInstanceSpecs operation. For more information, see List of operations by function. For more information about the data and permissions that are required to call this operation, see API documentation.
Create a RAM user and grant permissions to the RAM user
Identities
You can call this operation by using an Alibaba Cloud account, a Resource Access Management (RAM) user, or a RAM role. For more information about the differences between the identities, see Identity, credential, and authorization. In this topic, a RAM user is used as an example.
You can log on to the RAM console, create a RAM user and grant only the permissions to call operations to the RAM user, and then record the AccessKey pair. For more information, see Create a RAM user.
Authorization
Go to the Users page of the RAM console. Find the RAM user that you want to manage and click Add Permissions in the Actions column.
In the Policy section, search for and select the AliyunYundunNewBGPAntiDDoSServicePROFullAcces and AliyunYundunAntiDDoSPremiumFullAccess policies.
Note
Anti-DDoS Proxy provides the following system policies:
AliyunYundunNewBGPAntiDDoSServicePROFullAccess: the permission to manage Anti-DDoS Proxy (Chinese Mainland).
AliyunYundunNewBGPAntiDDoSServicePROReadOnlyAccess: the read-only permission to access Anti-DDoS Proxy (Chinese Mainland).
AliyunYundunAntiDDoSPremiumFullAccess: the permission to manage Anti-DDoS Proxy (Outside Chinese Mainland).
AliyunYundunAntiDDoSPremiumReadOnlyAccess: the read-only permission to access Anti-DDoS Proxy (Outside Chinese Mainland).
AliyunYundunDDoSRewardsReadOnlyAccess: the read-only permission to access value-added features of Anti-DDoS Proxy.
AliyunYundunDDoSRewardsFullAccess: the permission to manage value-added features of Anti-DDoS Proxy.
For more information about how to create a custom policy, see RAM authorization.
Click Grant permissions to complete the authorization.
Credentials
By default, an AccessKey pair is generated when you create a RAM user. You can also go to the details page of the RAM user. On the Authentication tab, click Create AccessKey to create an AccessKey pair. For more information, see Create an AccessKey pair.
Call the operation
The following example shows how to call the operation in Python.
Prepare a Python environment
Download and install Python.
For more information about how to download Python 3, visit Python 3.
Check the version of Python.
Configure environment variables
In this example, environment variables are configured to manage the AccessKey pair and prevent security risks that are caused by hard-coding the AccessKey pair into your business code. The method that is used to configure environment variables varies based on the operating system. For more information, see Configure environment variables in Linux, macOS, and Windows.
Install dependencies
pip install alibabacloud_credentials
pip install alibabacloud_ddoscoo20200101==1.0.3
pip install alibabacloud_tea_console
Download the sample code
Call the DescribeInstanceSpecs operation in OpenAPI Explorer. For more information, see DescribeInstanceSpecs.
Set the InternetIp parameter to ddoscoo-cn-nwy3c8k6****] and click Initiate Call.
Click the SDK Sample Code tab. Then, go to the Languages section and click Python.
The system provides the sample code of the API call based on SDK for Python.
Click Download Project to download the sample code package.
Decompress the sample code package on your computer and access the alibabacloud_sample directory.
Run sample code
Run the following command:
The following output is returned:
{
"RequestId": "B0A0C363-514E-5A93-BB26-2DB3C2E97BE7",
"InstanceSpecs": [
{
"ConnLimit": 100000,
"PortLimit": 50,
"InstanceId": "ddoscoo-cn-nwy3c8k6****",
"DomainLimit": 50,
"SiteLimit": 5,
"RealLimitBw": 0,
"ElasticQps": 0,
"QpsLimit": 3000,
"CpsLimit": 5000,
"BaseBandwidth": 30,
"ElasticBw": 0,
"ElasticQpsMode": "month",
"FunctionVersion": "enhance",
"ElasticBwModel": "month",
"ElasticBandwidth": 30,
"BandwidthMbps": 100
}
]
}