amazon ec2 - How can I get a list reserved instances (reserved in advance) from a AWS account using API -
i trying build report list instances particular account has have been reserved in advance 1 time upfront fee.
this c# code give list of reserved instances have:
amazonec2 ec2 = awsclientfactory.createamazonec2client( accesskey, secretaccesskey ); describereservedinstancesrequest request = new describereservedinstancesrequest(); try { describereservedinstancesresponse response = ec2.describereservedinstances(request); foreach (reservedinstances ri in response.describereservedinstancesresult.reservedinstances) { console.writeline(ri.reservedinstancesid + "\t" + ri.instancetype + "\t" + ri.instancecount.tostring() + "\t" + ri.purchasestate); } } catch (amazonec2exception ex) { console.writeline("caught exception: " + ex.message); console.writeline("response status code: " + ex.statuscode); console.writeline("error code: " + ex.errorcode); console.writeline("error type: " + ex.errortype); console.writeline("request id: " + ex.requestid); console.writeline("xml: " + ex.xml); }
Comments
Post a Comment