I searched endless hours for this but I was unable to find anything that could help me. As you can see, I've already wrote the code to retrieve the launch-time of a running instance and I just need to get it in a proper format so that I can use dateDiff() function to find the total instance running time in seconds (i.e. till now).
'getltimef' should be in dateDiff readable format and 'timeinsec' would be the final output (time elapsed). Starttimer() function would start a silent timer that will also keep updating the value of 'timeinsec' variable.
Could someone help me with this, please?
References:
1] PHP Parsing Amazon EC2 instance 'launchTime'
Function getinfo()
Set instanceid = CreateObject("MSXML2.XMLHTTP.3.0")
Set regiondata = CreateObject("MSXML2.XMLHTTP.3.0")
instanceid.Open "GET", "http://ift.tt/N6UOsk", False
instanceid.Send
regiondata.Open "GET", "http://ift.tt/1lcAxuq", False
regiondata.Send
Const getltimeFinished = 1
Const getltimeFailed = 2
getltimeCommand = "aws ec2 --region " regiondata.responseText " describe-instances " instanceid.responseText "--filter=""launch-time"""
Set getltimeShell = CreateObject("WScript.Shell")
Set getltimeShellExec = getltimeShell.Exec(getltimeCommand)
Select Case getltimeShellExec.Status
Case getltimeFinished
launchtimedetermined = true
getltimeOutput = getltimeShellExec.StdOut.ReadAll
Case getltimeFailed
launchtimedetermined = false
End Select
if (launchtimedetermined) = false Then
timeinsec = 240
Else
'getltimef script'
'getltimef = maybe regexp can work here?'
'timeinsec = datediff("s", getltimef, now())'
Call starttimer()
End Function
Thank you!
Aucun commentaire:
Enregistrer un commentaire