getMetricData from AWS Cloud Watch using Java SDK: In this tutorial, we will see how to get the Cloud watch metric data from AWS using Java SDK.

AWS has multiple services, Cloud watch is one of the services which is used to get details monitoring of services you have enabled.

By Default, AWS will give you limited access to monitoring without any extra payment but we need to get in detailed monitoring of any instance or any service in ec2 or dynamnodb we need to enable cloudwatch.

There are multiple SDKs available with AWS to get metric information or modify information.

We are using JAVA SDK to get the metrics information. In a single method call, we can get up to 100 metrics and we can use the custom Metric aswell.

First Create a Java maven project and add below dependency management into your pom file

Add below dependencies to your POM file 

Then Create you Request body which need to be send to AWS Console 

  • We need to pass the start and end time to get the time range
  • We can send multiple json object in metricDataQueries to get multiple metrics 
  • For Getting  dimensions object use below Code 
  • After getting dimensions and required metrics create Json Object 
  • Now create an actual call for getting metrics 

Run GetmetricData class as for output.

Thanks

Also Read: HTML Code for Popup Window 

getMetricData from AWS Cloud Watch using Java SDK Example

Leave a Reply

Your email address will not be published. Required fields are marked *