Counting hosts in a group form an ec2 dynamic inventory

Is it possible in a playbook to get a list of all (including disabled) hosts in a group using a dynamic inventory connected to ec2.

We have a 10 host limit on our ansible tower which allows a small team to spin up ec2 instances. they occasionally stop them … and then spin up 2nd machines, it only takes 2 of the guys to do this and then we have more than 10 hosts and the tower licenses are used up which then locks out ansible (nothing can run due to us running out of hosts) … and I have to start working in aws console to terminate the instances as it cannot be done via the tower anymore.

I am looking into a way to add a new play to count the total number of hosts and stop the creation of anymore hosts if a limit is breached

The usual way would be to tag the instances and pick them up at the start of your play, put them in a group and count them. However, the dynamic inventory contains the running instances only otherwise your plays will fail running against stopped instances. Not sure how to get around this.