在Node.js中显示检索到的aws实例到HTML页面

我有一个代码从aws中检索实例

var aws = require('aws-sdk'); aws.config.update({ accessKeyId: 'YOUR_ACCESS_KEY', secretAccessKey: 'YOUR_SECRET_KEY', region: 'us-west-2' }); var ec2 = new aws.EC2(); function printStatuses() { ec2.describeInstances({}, function(err, data) { if(err) { console.error(err.toString()); } else { var currentTime = new Date(); console.log(currentTime.toString()); for(var r=0,rlen=data.Reservations.length; r<rlen; r++) { var reservation = data.Reservations[r]; for(var i=0,ilen=reservation.Instances.length; i<ilen; ++i) { var instance = reservation.Instances[i]; var name = ''; for(var t=0,tlen=instance.Tags.length; t<tlen; ++t) { if(instance.Tags[t].Key === 'Name') { name = instance.Tags[t].Value; } } console.log('\t'+name+'\t'+instance.InstanceId+'\t'+instance.PublicIpAddress+'\t'+instance.InstanceType+'\t'+instance.ImageId+'\t'+instance.State.Name); } } } }); } 

上面的代码工作正常,它检索实例并显示在terminal中,我想在前面的视图中显示在HTML页面上。 我已经开发了前端页面,并希望实例出现在此页面(在表格标签内)而不是控制台。

 front end html code <!DOCTYPE html> <html> <head> <script type="text/javascript"> </script> <meta charset="ISO-8859-1"> <style> th {background-color:lightgrey; } h1 {color:blue; text-align:center;} p {color:blue; text-align:left;} </style> </head> <body> <form action="/" method="post"> <table width="100%" border=1> <tr> <th>Instances</th> <th>Status</th> <th>Start/Stop</th> </tr> <tr> <td id="instance"></td> <td id="status"></td> <td> <button id='start'>start</button> <button id='stop'>stop</button></td> </tr> </table> </body> </html>