This topic describes how to use Alibaba Cloud SDK for Python to modify the maximum bandwidth of an elastic IP address (EIP).
Prerequisites
Before you use Alibaba Cloud SDK for Python, make sure that the following requirements
are met:
- An Alibaba Cloud account and the AccessKey pair are obtained. You can create and view your AccessKey pair on the Security Management page of the Alibaba Cloud Management Console.
- Make sure that Alibaba Cloud SDK for Python is installed. For more information, see aliyun-python-sdk-vpc 3.0.12.
- The VPC Python example library is downloaded.
Go to the directory where the setup.py file is stored, and run the following command to initialize the environment:
python setup.py install
Background information
- Create an EIP in the China (Hangzhou) region.
- Set the maximum bandwidth value of the EIP to 50 Mbit/s.
- Query the EIP for which you have modified the maximum bandwidth value.
- Set the maximum bandwidth value of the EIP to 10 Mbit/s.
- Query the EIP for which you have modified the maximum bandwidth.
- Release the EIP.
Procedure
Result
The following output is returned:
---------------------------allocate_eip_address---------------------------
{
"EipAddress": "47.XX.XX.225",
"ResourceGroupId": "rg-acfm4od****",
"RequestId": "9318DD7A-F065-4EA6-9EA0-20A9C46EDADC",
"AllocationId": "eip-bp15bzjk5djcs****"
}
---------------------------modify_eip_address---------------------------
{
"RequestId": "C39D55A1-6B47-489B-8614-FDB9736EDE73"
}
---------------------------describe_eip_address---------------------------
{
"TotalCount": 1,
"PageNumber": 1,
"PageSize": 10,
"EipAddresses": {
"EipAddress": [
{
"ISP": "BGP",
"ExpiredTime": "",
"InternetChargeType": "PayByBandwidth",
"IpAddress": "47.XX.XX.225",
"AllocationId": "eip-bp15bzjk5djcs****",
"PrivateIpAddress": "",
"Status": "Available",
"BandwidthPackageId": "",
"InstanceId": "",
"InstanceRegionId": "",
"RegionId": "cn-hangzhou",
"AvailableRegions": {
"AvailableRegion": [
"cn-hangzhou"
]
},
"ResourceGroupId": "rg-acfm4od****",
"HasReservationData": false,
"InstanceType": "",
"AllocationTime": "2019-04-18T04:01:28Z",
"Name": "EIP_NEW_NAME",
"OperationLocks": {
"LockReason": []
},
"Mode": "NAT",
"BandwidthPackageType": "",
"BandwidthPackageBandwidth": "",
"Bandwidth": "50",
"HDMonitorStatus": "OFF",
"ChargeType": "PostPaid",
"SecondLimited": false,
"Descritpion": ""
}
]
},
"RequestId": "51ECAB45-2518-4A46-89DC-8ADEE1AFDBE9"
}
---------------------------modify_eip_address---------------------------
{
"RequestId": "ACAB5724-D05C-46A4-8C2B-6064AEEC792B"
}
---------------------------describe_eip_address---------------------------
{
"TotalCount": 1,
"PageNumber": 1,
"PageSize": 10,
"EipAddresses": {
"EipAddress": [
{
"ISP": "BGP",
"ExpiredTime": "",
"InternetChargeType": "PayByBandwidth",
"IpAddress": "47.XX.XX.225",
"AllocationId": "eip-bp15bzjk5djcs****",
"PrivateIpAddress": "",
"Status": "Available",
"BandwidthPackageId": "",
"InstanceId": "",
"InstanceRegionId": "",
"RegionId": "cn-hangzhou",
"AvailableRegions": {
"AvailableRegion": [
"cn-hangzhou"
]
},
"ResourceGroupId": "rg-acfm4od****",
"HasReservationData": false,
"InstanceType": "",
"AllocationTime": "2019-04-18T04:01:28Z",
"Name": "EIP_NEW_NAME",
"OperationLocks": {
"LockReason": []
},
"Mode": "NAT",
"BandwidthPackageType": "",
"BandwidthPackageBandwidth": "",
"Bandwidth": "10",
"HDMonitorStatus": "OFF",
"ChargeType": "PostPaid",
"SecondLimited": false,
"Descritpion": ""
}
]
},
"RequestId": "6F653A80-AB28-4842-84A8-CD444EB81A29"
}
---------------------------release_eip_address---------------------------
{
"RequestId": "C407633A-5658-482F-AB5E-069028C3B06C"
}