Search code examples
amazon-web-servicesmetricsamazon-lightsail

How can i get NetworkIn and NetworkOut metrics in Amazon Lightsail?


I am using amazon lightsail and i tried to get metrics of Instance using getInstanceMetricData API and also CLI.but I did not get Metric values for NetworkIn and NetworkOut.It returns only empty object.I attached a getInstanceMetricData request code.Is there any solution for this?
It's a code i tried :
It's a code i tried,Enter here to view


Solution

  • Please check with start time it should be a instance metric generating graph at every 5 min then you try it at every 10 minutes, like that:

    Long startDate1 = date.getTime() - (10 * 60 * 1000);
    

    Seems to be working in that mode