Skip to content

Filter for On-Demand instances in AWS Ec2 service page

0

Hello,

We have mixed instances that include spot and on-demand. There is a instance attribute / API filter called Instance Lifecycle that lets you filter for the spot instances. However, there is no option to filter for on-demand or normal lifecycle instances. Is there a way to filter on-demand ec2 instances in Ec2 service page?

Thank you

asked 2 years ago280 views

1 Answer
-2

Yes, there is a way to filter for On-Demand EC2 instances on the EC2 service page, although it's not as straightforward as filtering for Spot instances.

To filter for On-Demand instances, you can use the "Instance lifecycle" attribute, but you'll need to approach it differently. Since On-Demand instances don't have a specific lifecycle value like Spot instances do, you can use an inverse filter to exclude Spot instances, which will effectively show you only the On-Demand instances.

Here's how you can do it:

  1. Go to the EC2 service page in the AWS Management Console.
  2. In the instance list view, look for the filter or search bar.
  3. Select "Instance lifecycle" as the attribute to filter by.
  4. Instead of selecting a value, you can use the "does not equal" or "is not" operator (the exact wording may vary depending on the console interface).
  5. Set the value to "spot".

This filter will exclude all Spot instances, leaving you with a list of your On-Demand instances.

If you're using the AWS CLI or API, you can achieve the same result by using a filter that excludes the "spot" lifecycle. The exact syntax would depend on the specific command or API call you're using.

It's worth noting that this method assumes that all your instances are either On-Demand or Spot. If you have other types of instances (like Reserved Instances), they would also be included in this filtered view. However, for most use cases, this approach should effectively allow you to view and manage your On-Demand instances separately from your Spot instances.
Sources
EC2 instance creation - vCPU limit issue | AWS re:Post
Community | Introduction to Amazon EC2
Amazon EC2 Cost and Capacity Optimization | Amazon Web Services

answered 2 years ago

  • The operator only has two options that are Equals or Contains. It does not have does not equal to or is not.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.