-->

Friday, November 27, 2015

Verifying all running instance types in Amazon AWS

If you have reserved your instances , than you should track which all instances are running in your environment. Like if you have reserved m4.large instance so you are always billed for them whether you spawn it up or not you are charged for it.

So if you suppose reserved 5 instances of m4.large than you should make sure that 5 instances of m4.large is running at all times. But this can be difficult from checking this information from the console , you can grep all the m4.large instances from the AWS CLI.

Use the following command to see all the instance types running in your environment.

 aws ec2 describe-instances | grep InstanceType | cut -d "\"" -f4 | sort | uniq -c  




Additionally you simply count the number of m4.large instances as follows

 aws ec2 describe-instances | grep InstanceType | grep m4.large| cut -d "\"" -f4 | sort | uniq -c | wc -l 

This should always return a value more than 5 i.e. you are running 5 or more than 5 instances in your aws cloud. You can even run a simple script to keep a track of such situation and alerts you whenever the count goes below 5 in this case.



0 comments:

Post a Comment