I am currently running the following query
aws ec2 describe-reserved-instances \
--filters "Name=state,Values=active" \
--query "ReservedInstances[].{InstanceType:InstanceType,ProductDescription:ProductDescription,InstanceCount:InstanceCount}"
In order to obtain something resembling the following:
{
"ProductDescription": "Linux/UNIX (Amazon VPC)",
"InstanceType": "m3.medium",
"InstanceCount": 44
}
I am looking to get the instances already utilized though as well and am not finding a sane way to do this I would like a report showing the following information.
{
"ProductDescription": "Linux/UNIX (Amazon VPC)",
"InstanceType": "m3.medium",
"InstanceCount": 44,
"InstancesUsed": 44,
"UtilizationPercentage": "100%"
}
How would I end up with instances used along with utilization percentage?
NOTE
In order to get percentage I can variable cast, then use the following...
Percentage() { echo "$((200*$1/$2 % 2 + 100*$1/$2))%" ; }
Percentage 44 44 //100%