ec2-check-reserved-instances
ec2-check-reserved-instances copied to clipboard
Error?
Got this in my shell, not sure if it means anything:
You will see this error when you have no reservations and when you have no running instances. To get around this problem, I added conditional logic around the summations. The below if...else blocks will resolve this error.
if len(running_instances.values()) > 0:
qty_running_instances = reduce( lambda x, y: x+y, running_instances.values() )
else:
qty_running_instances = 0
if len(reserved_instances.values()) > 0:
qty_reserved_instances = reduce( lambda x, y: x+y, reserved_instances.values() )
else:
qty_reserved_instances = 0