You can call an API operation based on the RAM user information and the region ID to check memory usage of the instances under the current account. The script is as follows:
Note The query result is the memory usage during the period 20 minutes before the current time of the instances.
- Install the Alibaba Cloud Python SDK dependency package by running the following command:
pip install aliyun-python-sdk-core.
- Run the preceding script file in Python. In the script, the -r parameter is cn-hangzhou
by default. Separate multiple region values with commas. The detailed command is as
python get_used_memory.py -i ****** -s **********-r cn-hangzhou,cn-beijing -o XXX.csvNote You can run the
python get_used_memory.py –hcommand to check the usage of each parameter.