How to find which Amazon AWS EC2 instances are not covered by a Reserved Instance reservation

amazon ec2amazon-web-servicesreserved-instances

Let's assume that I have 20 running EC2 instances and 10 active Reserved Instance reservations.

Using the AWS Console or AWS CLI, what is the fastest way to determine which of the running EC2 instances are not 'covered' by a Reserved Instance reservation?

To give more clarity on the desired result, consider the following (not possible in the AWS console that I'm aware of):

  1. Get a list of all running instances in a region. You can do this in the AWS console today and via the AWS CLI.
  2. Get a list of all active Reserved Instance reservations in the same region. you can do this in the AWS console today and via the AWS CLI.
  3. Cross-check the two lists: Every time you see a running instance of size X in zone Y, and there is a Reserved Instance reservation of size X in zone Y, remove it from the running list.
  4. The remainder of instances in the modified running list are all those that are not covered by a Reserved Instance reservation.

I'm looking for a way to get #4 without having to manually copy the two lists available in the AWS console to Excel and manually crossing off running instances as I see a corresponding RI reservations. I could write a script that uses the CLI to do this too, but I was assuming that there might be something that already exists since this is an obvious way of analyzing cost efficiency.

Best Answer

If all your EC2 instances are of the same type and in the same region, I don't think there is any way to know which one is covered an which one is not, because a reserved instance is just a billing concept. A reserved instance is never really assigned to a specific EC2 instance.

AWS will look at how many instances you have running and how many reserved instances you have bought and will bill you accordingly. So the best way to determine if you have EC2 instances not covered by your reserved instances is to analyze your AWS bill details and look for the EC2 usage that is not billed as reserved instance.

Related Topic