List RHEL EC2 instances

Greg asked:

We have a mix of Amazon and RHEL EC2 Linux instances. I’m going to purchase instance reservations, but I need to know how many reservations of each to buy. I don’t know how to do that short of SSHing into each instance and looking around. I know the RHEL instances are being billed separately by looking at the account activity, so Amazon must have the info; I just don’t know where to find it.

I tried the ec2-describe-instances command, which says that it lists the product codes, (which I’m hoping I could parse into Amazon or RHEL) but I don’t see them. It lists the key name, the launch index, then the instance type. The documentation suggests that the product codes would be listed before the instance type, but I don’t see them.

My answer:


Just feed the AMI IDs of your instances to ec2-describe-images. For example:

ec2-describe-images ami-35792c5c ami-a25415cb

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.