I want to make sure the instance has passed the two status checks(System/Instance reachability check) using command line.
When I run this
ec2-describe-instance-status
ec2-describe-instance-status XX($InstanceID)
it would show running instances like
INSTANCE $InstanceID $REGION running 16
But when I tried adding a filter to make sure the instance passed the status check
ec2-describe-instance-status XX($InstanceID) --filter instance-status.reachability=passed
ec2-describe-instance-status XX($InstanceID) --filter "instance-status.reachability=passed"
ec2-describe-instance-status --filter instance-status.reachability=passed
nothing ever returned.
I've double-checked the instances are running fine and actually passed the 2 status checks, but why nothing is returned after applying the filters?
Update:
In response to Rico, I tried the -v
option
ec2-describe-instance-status -v
returns one item in the instanceStatusSet, with the fields
<item>
<instanceId>i-XXX</instanceId>
<availabilityZone>us-east-1d</availabilityZone>
<instanceState>
<code>16</code>
<name>running</name>
</instanceState>
</item>
while
ec2-describe-instance-status --filter instance-status.reachability=passed -v
ec2-describe-instance-status --filter "instance-status.reachability=passed" -v
both return an empty instanceStatusSet...
Use the AWS Command Line Interface unified tool instead.
aws ec2 describe-instance-status --instance-ids i-01234567 --filters Name=instance-status.reachability,Values=passed
{
"InstanceStatuses": [
{
"InstanceId": "i-01234567",
"InstanceState": {
"Code": 16,
"Name": "running"
},
"AvailabilityZone": "us-west-2c",
"SystemStatus": {
"Status": "ok",
"Details": [
{
"Status": "passed",
"Name": "reachability"
}
]
},
"InstanceStatus": {
"Status": "ok",
"Details": [
{
"Status": "passed",
"Name": "reachability"
}
]
}
}
]
}