I received a text message from Alibaba Cloud some time ago:
From 00:00 on January 5, 2024, the public network outbound traffic of the Function Compute service will be switched to the CDT billing model. Existing users of Function Compute can enjoy 100GB of traffic per month for one year, and new users can enjoy 100GB of public network traffic for three months. I also studied this CDT and found that it can not only deduct the traffic of Function Compute, but also the pay-as-you-go traffic of Elastic Internet Protocol (EIP). The commonly supported products are as follows:
From this perspective, old Function Compute users are getting 100G of traffic per month for free for a year, which is pretty good. If you use Alibaba's recently launched 99 yuan/year 2C/2G/3M cloud server and downgrade it to a pay-as-you-go bandwidth and change it to an elastic IP, you can get a 50% refund on the bandwidth fee and then increase the bandwidth configuration to 200M. This means you only need 49 yuan to get: 1 year of 2C/2G/200M bandwidth/100G traffic per month cloud server.
Advantages and Disadvantages
Disadvantages
- 100G of traffic can only be used for one year at most, and then only 10G of free traffic per month
- If the bandwidth is attacked or the traffic is exceeded, it will be charged at a price of 0.8 yuan per G
- Since Alibaba's 99 yuan server is sold as a package, it is not possible to enjoy the same price renewal after changing to a volume-based model
Advantages
- Cheap, high bandwidth, annual use
Specific operations
Bandwidth billing changes to CDT billing mode (cloud data transfer)
If you have purchased a 99 yuan server, enter the Cloud Data Transfer CDT console, pull down the region, and select the same region as your server. To enable elastic public IP here, charge by CDT.
Bandwidth changed to pay-as-you-go
If you have already purchased a 99 yuan server, enter the ECS console, select Resource configuration
next to your server --> pull down Other instance configuration functions
--> Reduce configuration
--> Reduce bandwidth configuration
Then click Continue and change to Pay-as-you-go
here. The bandwidth size configuration can be left unchanged, because the maximum here can only be increased to 100M.
Bandwidth changed to elastic IP
I forgot to take screenshots of the specific steps, but you can refer to Alibaba's document: Converting ECS fixed public IP to elastic public IP of private network type
Maximize bandwidth size
Enter the elastic public network console, select bandwidth configuration, and increase its peak bandwidth to 200M
Check whether the elastic public network IP is billed according to CDT
Traffic usage monitoring and suggestions
Monitoring
If you are using Prometheus monitoring, you can consider monitoring and warning the monthly traffic usage of the server to prevent traffic overload. The following is the monthly usage reset & PromQL syntax
Network card monthly usage reset
Create a new script: /opt/ops_tools/clear_flow.sh
modprobe -r virtio_net;modprobe virtio_net
Remember to give execution permissions: chmod +x /opt/ops_tools/clear_flow.sh
The instructions in the above script will clear the server eth0 network card traffic and recount. (The server will be disconnected for about 2 seconds in the middle, but it doesn't have much impact)
Configure the task plan: Execute the above script at 0:00 on the 1st of each month
# Add to the task plan
echo '0 0 1 * * /opt/ops_tools/clear_flow.sh' >> /var/spool/cron/root
# Restart the crond service and start it automatically at boot
systemctl restart crond && systemctl enable crond
Usage monitoring
Statistics can be obtained through Prometheus's PromQL (unit: GB):
(sum by (instance)(node_network_receive_bytes_total{device=~"eth.*", server="这里改为你的主机名"}) + sum by (instance)(node_network_transmit_bytes_total{device=~"eth.*", server="这里改为你的主机名"})) / (1024 ^ 3)
Query results:
Then, add the above query statement to rules, for example, if it exceeds 60G
, an alarm will be issued
(sum by (instance)(node_network_receive_bytes_total{device=~"eth.*", server="Change to your host name here"}) + sum by (instance)(node_network_transmit_bytes_total{device=~"eth.*", server="Change to your host name here"})) / (1024 ^ 3) > 60
Recommendations
If there is no special requirement, it is recommended to use Alibaba's original package, which can be renewed for four years at 99! If you must use it, monitor and control the source of access, and try not to open the service casually to avoid traffic being brushed!
One comment
好便宜啊,99元