amazon web services - AWS: how to get the instance status check state, not state -
the aws console show 2 columns state , status checks, when instance launching. state of running not true reflection of state because status checks fail.
anyone have examples of .net c# code check status check state?
the closest have this:
var request = new describeinstancestatusrequest(); request.instanceid = insts.select(i => i.instanceid).tolist(); describeinstancestatusresponse response = ec2client.describeinstancestatus(request); instancestatus instancestatus = response.describeinstancestatusresult.instancestatus[0]; console.writeline("availability zone - " + instancestatus.availabilityzone); console.writeline("instance state code - " + instancestatus.instancestate.code); console.writeline("instance state name - " + instancestatus.instancestate.name); foreach (instancestatusevent statusevent in instancestatus.instancestatusevent) { console.writeline("event code - " + statusevent.code); console.writeline("event description - " + statusevent.description); console.writeline("earliest scheduled start time - " + statusevent.notbefore); console.writeline("latest scheduled end time - " + statusevent.notafter); }
but gives state, not status checks.
you need deeper instancestatus object. status checks in instancestatusdetail
, systemstatusdetail
properties. here snippet gets information you:
var status = result.instancestatus[0]; console.writeline("instance status = " + status.instancestatusdetail.status); console.writeline("instance status detail name = " + status.instancestatusdetail.detail[0].name); console.writeline("instance status detail status = " + status.instancestatusdetail.detail[0].status); console.writeline("system status = " + status.systemstatusdetail.status); console.writeline("system status detail name = " + status.systemstatusdetail.detail[0].name); console.writeline("system status detail status = " + status.systemstatusdetail.detail[0].status);
Comments
Post a Comment