Discover Instances

Discover AWS instances based on specified criteria.

Source codePermissions

Usage

Input

Parameter Description Type Required Default value
instance_ids Instance IDs to focus on list(string) No All instances
states Filter instances by states
pending, running, shutting-down, terminated, stopping, stopped
list(string) No running,stopped,pending,stopping
tags Filter instances by tags
Key=Value or Key
list(string) No None
public Filter instances by public ip bool No False
os Filter instances by Windows or Linux operating system
linux, windows
string No None
invert Return instances that didn’t conform to the supplied parameters bool No None
region Region for operation string No Session default
debug Increase log verbosity bool No False
silent Decrease log verbosity bool No False
output Output format
table
string No None
session Established session object No None

Output

Returns a list of discovered instance IDs:

['i-1234567890abcdef0', 'i-abcdef1234567890']

Examples

Discover public windows instances in running or stopped state:

aaws ec2 discover_instances --states running stopped --public --os windows

Discover if specific instances are missing specific tags:

aaws ec2 discover_instances --tags Owner Name=example --instance_ids i-1234567890abcdef0 i-abcdef1234567890 --invert