I am trying a quick way to list/output all instances type running in my environment. Nothing else just a list of those InstanceType.
I can easily get them on the console but it's a bit time consuming.
Thanks in advance!
I am trying a quick way to list/output all instances type running in my environment. Nothing else just a list of those InstanceType.
I can easily get them on the console but it's a bit time consuming.
Thanks in advance!
AWS CLI -
aws ec2 describe-instances --region eu-west-1 --query 'Reservations[*].Instances[*].InstanceType' --output text | sort | uniq
In AWS web console - You can also use AWS Config -> Advanced queries -> Query editor as shown below. Output can be exported as json or csv. Also have aws cli for this.
Personally I use Steampipe to query AWS (and other cloud) resources using SQL from my terminal. Per your question, I've also limited resources to those "running":
select
instance_type,
count(*)
from
aws_ec2_instance
where
instance_state = 'running'
group by
instance_type
order by
count