I am calculating my total number of reserved instance on the basis of instance_type
and I'm storing this in a dictionary by instance_type
as a key.
Firstly, I'm finding my all reserved instances by get_all_reserved_instances()
, then for each instance returned by this, I do this:
if each.state != 'retired':
key = str(each.instance_type)
res_count[key]+=each.instance_count
I'm also calculating total number of instances on the basis of instance_type
. Firstly, I'm finding my all instances by get_all_instances()
and then for each instance_type
I do this:
if each.state == 'running':
key = str(each.instance_type)
all_count[key]+=1
Now for one instance type it returns:
all_count = 17
res_count = 19
How's it possible that res_count
is greater than all_count
?
res_count
can be equal to all_count
, if there is no ondemand
instance, but why this is greater than all_count
?
can a non-retired instance also be not running ? if it is,then i think this is case for this difference.
Is there any fault of using state or is there another reason?