Last update at :2023-12-26,Edit by888u
The peak bandwidth of Tencent Cloud Lightweight Cloud Server is larger than that of cloud servers. The disadvantage is that it limits a certain amount of traffic. So "Will Tencent Cloud Lightweight Cloud Server be directly suspended if the traffic exceeds the limit?"
The answer is no. If the user's traffic exceeds the package limit, the account balance will be deducted until the balance is in arrears.
If this is the case, can you set the traffic limit and pause it directly?
The answer is also no. You cannot find the settings in the Tencent Cloud management panel, so please pay attention to the traffic according to your own usage needs. If you find that it is insufficient, you can shut down the machine in advance and wait until it is reset next month and then turn it on again. !
Tencent Cloud Hong Kong/Singapore/Japan/Silicon Valley lightweight application server configuration package and monthly payment price:
- CPU: 1cores
- Memory: 1GB
- Hard disk: 25G SSD
- Bandwidth: 30Mbps
- Traffic: 1000G
- Architecture: KVM
- Price: 24 yuan/month
- Send: Purchase link
- CPU: 1cores
- Memory: 2GB
- Hard disk: 50G SSD
- Bandwidth: 30Mbps
- Traffic: 2000G
- Architecture: KVM
- Price: 34 yuan/month
- Send: Purchase link
So how can Tencent Cloud lightweight cloud server be set to automatically shut down when the traffic exceeds?
The following is the automatic shutdown solution for Tencent Cloud lightweight service when the traffic exceeds the limit:
How to use
Install Tencent Cloud Python SDK 3.0
pip3 install tencentcloud-sdk-python #python3
Parameters
SecretId="" SecretKey="" region="" percent= 0.95
Explanation:
1. For SecretId and SecretKey, please go to Tencent Cloud to access the management console: https://console.cloud.tencent.com/cam/capi
2. Region refers to the region where the server is located, please refer to the following table
North China (Beijing) | ap-beijing |
---|---|
Southwestern Region (Chengdu) | ap-chengdu |
South China (Guangzhou) | ap-guangzhou |
Hong Kong, Macao and Taiwan (Hong Kong, China) | ap-hongkong |
East China (Nanjing) | ap-nanjing |
East China (Shanghai) | ap-shanghai |
Asia Pacific Southeast (Singapore) | ap-singapore |
Asia Pacific Northeast (Tokyo) | ap-tokyo |
European Region (Moscow) | eu-moscow |
Western United States (Silicon Valley) | na-siliconvalley |
3. Percent is the proportion of used traffic in the package. The default setting is 0.95. It will automatically shut down after exceeding the limit
Note: It is recommended to use it with crontab
Suppose you set the program to run every 15 minutes
crontab -e 15 * * * * /usr/bin/python3 /root/LightHouse_Automatic_Shutdown/LH.py >> /root/LightHouse_Automatic_Shutdown/LH.log 2>&1
Output
More features
- GitHub Actions version
- Tencent Cloud Function Edition
- server sauce push
- TG push
Note: The method comes from the "Love Demonstration" blog!
Recommended site searches: US server website, dynamic IP server, Korean high defense server ICP registration website, domain name registration website, ICP registration, .cn domain name registration, registration query network, Wanwang domain name space, Korean server recommendation,
p>
发表评论