This blog will be quite a short one in which we will be looking into how we can filter out the number of Windows Instances In your AWS Account. We Can do this from both AWS Console and Using the AWS CLI.
By directly looking into the Ec2 dashboard, It’s quite difficult to Identify which One is the Windows or Which one is the Linux Instances. Let’s See how we can do this.
AWS Command Line (AWS CLI)
Before you run the AWS CLI make Sure that you have already Installed the AWS CLI
Make Sure IAM role is attached to the Server with required Permission, or Use Access key Id and Secret Access key to Interact with yout AWS Account.
Execute the below command to list out all the Instances with It’s Platform.
root@ip-172-31-27-180:~# aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId,Platform]' --output text
To filter based on the Platform i.e, if you Only want to List out all the Windows Instances then execute the below command.
root@ip-172-31-27-180:~# aws ec2 describe-instances --filter "Name=platform, Values=windows" --query 'Reservations[].Instances[].[InstanceId,Platform,platformtype]' --output text
Using AWS Console.
It’s Very easy to filter out the Instances platform from the console, Just filter based on the Platform and select Windows.