3

How can I get the list of amazon ec2 instance using aws command line tool? I checked various available commands but could not fount one suitable for this purpose.

AppsWise
  • 141
  • 1
  • 6

2 Answers2

7
aws ec2 describe-instances --filters "Name=instance-state-code,Values=16"

Valid values for this filter:

The valid values are: 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 (stopping), and 80 (stopped).

Sourced from the CLI docs: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html

Barry Carlyon
  • 211
  • 1
  • 3
3

classic ec2 client:

  $ ec2-describe-instances

it has billions of filters, well more than 10.

current awscli

$ aws ec2 describe-instances
EEAA
  • 108,414
  • 18
  • 172
  • 242
Sum1sAdmin
  • 1,914
  • 1
  • 11
  • 20
  • 1
    FYI, the classic AWS tools are going the way of the dodo - we should be recommending to people that they use awscli now. – EEAA May 04 '16 at 17:35