How to Create & Configure CloudWatch dashboard on Amazon Web Service(AWS).
Amazon CloudWatch is a monitoring and management service that provides data and actionable insights for AWS, hybrid, and on-premises applications and infrastructure resources. With CloudWatch, you can collect and access all your performance and operational data in form of logs and metrics from a single platform.
Amazon CloudWatch is basically a metrics repository. An AWS service—such as Amazon EC2—puts metrics into the repository, and you retrieve statistics based on those metrics.You can use metrics to calculate statistics and then present the data graphically in the CloudWatch console.
- Login to aws portal.
- Click on Services.
- Under Management & Governance select CloudWatch.
- Click on Dashboards.
- Click on Create Dashboard.
- Provide Dashboard name.
- Click on Create dashboard.
- To add a line, number, text or Stacked area to your dashboard.
- Click on Next.
- Select data source:metrics or logs.
- Click on Configure.
- Select Metics :EC2,ELB,RDS or CodeBuild.
- Choose EC2.
- Select Metric name & instance-ID.
- Click on Create Widget.
- Click on Save dashboard.
Create Cloudwatch Dashboard using Shell
- Setup aws-cli on your system so click on link https://www.hackerxone.com/blog/how-install-configure-aws-cli-ubuntu-1804
- Run the following command:
aws cloudwatch put-dashboard –dashboard-name cli-dashboard –dashboard-body file.json(/path/of/json/file)
The file is a JSON format is given below:
{
“start”: “-PT6H”,
“periodOverride”: “inherit”,
“widgets”: [
{
“type”:”metric”,
“x”:0,
“y”:0,
“width”:12,
“height”:6,
“properties”:{
“metrics”:[
[
“AWS/EC2”,
“CPUUtilization”,
“InstanceId”,
“i-012345”
]
],
“period”:300,
“stat”:”Average”,
“region”:”us-east-1″,
“title”:”EC2 Instance CPU”,
“liveData”: false,
“legend”: {
“position”: “right”
}
}
},
{
“type”:”text”,
“x”:0,
“y”:7,
“width”:3,
“height”:3,
“properties”:{
“markdown”:”example”
}
}
]
}