You should pip install boto3
first.
Go to IAM Management Console to create access key.
Also, you should modify the instance_id
and region_name
in the script above.
Then, you can call get_used_bandwidth()
to get used bandwidth in Byte, or just run the script to get it in GB.