0 votes
1 view
in AWS by (12.3k points)

How can I get list of only running instances when using ec2-describe-tags. I am using my command like this:

ec2-describe-tags --filter "resource-type=instance" --filter "value=somevalue" --filter "key=key"

1 Answer

0 votes
by (18.6k points)

Use the following command to get the list of only running instances with describe tags:

aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId]' --filters Name=instance-state-name,Values=running --output text

Learn more about AWS by going through AWS course and master this trending technology.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !