If I run the below script on my EC2 server I get the number of VMs running/stopped in my account:
aws ec2 describe-instances --filters "Name=instance-state-name,