# Become a superhero in AWS cloud watch

In this blog, we’ll break down CloudWatch into easily digestible components, guiding you through setting up, configuring, and utilizing this powerful monitoring tool. From creating custom alarms and dashboards to analyzing log data and integrating with other AWS services.

# **Features of AWS CloudWatch**

* **Metrics**: CloudWatch collects and tracks metrics, which represent the performance of your resources, applications, and services. It provides predefined metrics for various AWS services, and you can also create custom metrics for your specific needs.
    
* **Alarms**: You can set alarms in CloudWatch based on metric thresholds to receive notifications or take automated actions when specific conditions are met. This allows you to respond proactively to issues affecting your infrastructure.
    
* **Dashboards:** CloudWatch Dashboards allow you to create customizable and shareable visualizations of your metrics, alarms, and logs. These dashboards provide a unified view of your AWS resources, applications, and services, which helps you monitor and troubleshoot issues effectively.
    
* **Logs:** CloudWatch Logs enable you to collect, store, and analyze log data from various AWS services and applications in a centralized location. You can use CloudWatch Logs Insights to query and analyze the log data to gain insights into your infrastructure’s performance and operational health.
    
* **Service Lens:** CloudWatch Service Lens is a feature that provides an end-to-end view of how your application’s components (services, microservices, AWS Lambda functions, etc.) are performing. It integrates with AWS X-Ray to allow you to monitor and troubleshoot your applications more effectively.
    

# **Prerequisites**

* [AWS Account](https://portal.aws.amazon.com/billing/signup#/)
    
* Any AWS resource running in your environment like EC2 instance, Lambda Function
    

# **Getting Started**

* Create or sign in to your [AWS account](https://portal.aws.amazon.com/billing/signup#/)
    
* In your AWS console, click on Services and search for CloudWatch in the search bar, and select it.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*7Sc6pMg8rSv3KtHa align="left")

* We’ll be creating dashboards from scratch in this tutorial; select Dashboards, and click on Create Dashboard.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*0NlQczhW4i2vGOpT align="left")

* Next, enter the name of your dashboard.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*ljkduGG_b3VSfj-v align="left")

Before you create your widget, you can choose the specific time range for your dashboard.

![](https://miro.medium.com/v2/resize:fit:1050/0*xcFaSjmCf2wK9zl1 align="left")

* The widgets are the contents of your dashboard, made up of charts, graphs, and advanced visualizations. After viewing the options, we can begin creating widgets for our CloudWatch service using the line widget and select Metrics.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*YKpqSPw4GXc7QQiP align="left")

In the Metrics section, you have a list of AWS resource metrics deployed in your region for you to choose from.

![](https://miro.medium.com/v2/resize:fit:1050/0*5X8_wG8PniXkypus align="left")

I’ll be using the EC2 metrics dashboard. Once I click on it, it’s going to generate the: EC2 metrics like:

* CPU Credit Balance
    
* CPU Credit Usage
    
* Status Check failed
    
* Network Out
    
* Status Check Failed
    
* CPU Credit Usage
    

A line chart in CloudWatch is a type of visualization that displays data as a series of data points connected by straight-line segments. It is used to track changes in data over time and is especially useful for monitoring trends, patterns, and performance of AWS resources, applications, and services.

![](https://miro.medium.com/v2/resize:fit:1050/0*zpDPgsTLR1A5zWI6 align="left")

* After creating your Widget, you can modify the data and attach new metrics from your instance or any AWS resource.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*uPEROHO-dqqn-IKK align="left")

* Next, let’s add more widgets to get advanced monitoring. Add a Stacked area to get the data visualization that displays the components of multiple categories stacked on top of each other from your AWS resource. The stacked area chart helps to show the cumulative effect of multiple data series, with each series represented by a different color or pattern.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*lc0HV-Fkb9scU4my align="left")

* In our stacked graph, we’ll use the EC2 metric; you can use any other metric you want to use.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*E14VdbqmcHoM3iS_ align="left")

* Next, click on Save. You’ll see all your metrics stacked on each other, showing the cumulative effects with different color patterns.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*f7hKK8UOUUhGGQpb align="left")

* Next, add a new event metric, and select across all metrics.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*PKGNLw8sPhhyFN3V align="left")

* Derive more meaning from your dashboard using the different time ranges and absolute or relative timing.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*qmcNZTfAwr9eccgK align="left")

# **Creating a CloudWatch Alarm**

* In your CloudWatch console, in the navigation pane, click on Alarms, then click the Create alarm button.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*ADRWMje_DJL791Hx align="left")

* In the **Create Alarm** wizard, you’ll first need to select a metric:
    
* Under Select metric, choose the service namespace for the metric you want to create an alarm for (e.g., EC2, Lambda, etc.).
    
* Browse the available metrics or use the search bar to find the desired metric.
    
* Select the metric and click the “Select metric” button.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*2h8NrOon4-UZo9L4 align="left")

* In the **Conditions** section, configure the following settings:
    
* Set the Threshold type to **Static** or “Anomaly detection, depending on your requirements.
    
* Define the alarm **statistic** (e.g., Average, Sum, Min, Max, or Sample Count) and the conditions (e.g., Greater Than Or Equal To Threshold, Greater Than Threshold, Less Than Threshold, or Less Than Or Equal To Threshold).
    
* Specify the threshold value and the evaluation period, which is the time window (in minutes) used to evaluate the alarm.
    
* In the **Actions** section, define what should happen when the alarm changes state:
    
* For the Alarm state trigger, you can send a notification, stop or terminate an instance, or perform other actions based on your needs. To send a notification, select **Send a notification to** and choose an existing Simple Notification Service (SNS) topic or create a new one. Optionally, you can also set actions for the OK state trigger and Insufficient data state trigger.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*4JEtuglYppGldZ7J align="left")

* Configure alarm settings such as name, description, and alarm state settings.
    
* Click the **Create Alarm** button to finish creating the CloudWatch alarm.
    

You can extend the CloudWatch functionality to create a log group for your resources. A CloudWatch Log Group is a container for log streams that share the same retention, monitoring, and access control settings.

* To access, and create a CloudWatch log group, in your CloudWatch navigation pane, choose Logs, and click on Actions
    

![](https://miro.medium.com/v2/resize:fit:1050/0*_iB9Z1rAq0Ja7l6H align="left")

* Click on Create log group. When you’re done creating your log group, click on Create.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*5mt4Em9WjoEoGpu- align="left")

* Back in your CloudWatch insights, select the log group you want to analyze.
    

![](https://miro.medium.com/v2/resize:fit:1050/0*jbde-qNVxFOjowxA align="left")

CloudWatch Logs Insights is a valuable feature of Amazon CloudWatch that allows you to interactively search, analyze, and visualize log data from your CloudWatch Log Groups. It plays a crucial role in efficiently managing, monitoring, and troubleshooting your AWS resources and applications.

# **Conclusion**

This blog has explored the power of Amazon CloudWatch as an essential monitoring and observability tool for your AWS resources, applications, and services. We’ve delved into key features such as metrics, alarms, log management, dashboards, and events.
