# Day - 78 (Grafana Cloud)

![Day 78: Unlocking Grafana Cloud Monitoring Mastery- An In-Depth Guide](https://cdn.hashnode.com/res/hashnode/image/upload/v1707570866611/db9a8755-6a58-4c2f-9a74-4d4aa59491a6.png?w=1600&h=840&fit=crop&crop=entropy&auto=compress,format&format=webp align="left")

## **Pre-requisites**

1. Create an EC2 instance.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707656881440/2d9dbe8e-99ed-4a70-b676-2738af0c5827.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707657237502/bb010eda-e196-4150-a96e-be23efa33606.png align="center")
    
2. We can install docker and run an image to view the EC2 usage of CPU, Memory, network connections, etc.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707656964712/ba1906d1-1317-4e75-adf5-9ae75ffb307f.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707657081415/b4bac0df-3037-4056-acd0-376db5e37d41.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707657126137/da43d113-4ae5-4248-b300-654c414362b3.png align="center")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685994560836/0533a05e-201c-45b3-8434-5ccbabf87329.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    

## **Setup Grafana Monitoring for EC2 instance**

1. We have learnt how to set up the Grafana cloud on my last blog. Navigate to the home page and click to connect data.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685994680524/4ccd9ebf-9084-4c8c-9fc3-50c32cca3702.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
2. In the dashboard install the Linux server conection to connect the EC2 instance to Grafana Cloud.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685995276033/66a098f5-e250-445e-a027-ef3b5d2bc093.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
3. Set up the connection settings. Run the Grafana agent.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685995453642/c259f564-2f94-4f0e-b6aa-2cffbf331e96.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
4. Choose the OS and architecture. Create an API token and run it in the EC2 instance.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685995524128/9ba7aa24-3449-4ae3-ad26-3905ff013430.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685995560556/627a1835-064a-4b0f-ab21-95017f823313.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
    Finally, proceed to install integration as shown in the above screenshot.
    
5. You can test agent configuration if it is collecting the data.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685996118797/7df5b927-3c06-4c55-84e3-7afecfe8a41a.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
6. Navigate to the dashboard in the Grafana cloud home page and add Amazon EC2 to view the complete monitoring of the AWS instance.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685996445995/1dac8fdb-dd26-4524-83e1-a8db27a7d152.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
7. We can organize the dashboard now to see all the real-time statuses in the server.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685996699832/ce17f8e3-adaf-4125-9485-cfd9bbe4226a.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    

## **Setup Grafana alert for AWS Billing**

1. We will be using AWS CloudWatch, in this case, to integrate it with Grafana Cloud to monitor the AWS Billing of the resources and set up the alert.
    
2. We can set up the billing alert in the AWS management console. Navigate to he AWS CloudWatch and select Metric.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707656516227/b0de137e-8f19-4a02-a778-e2a8ab858845.png align="center")
    
3. Select the Billing and Total estimated charge of USD.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998093433/c946c66c-c502-4561-92f4-eba0080319b9.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
4. We can now see the filled details and can modify the field required. Select the threshold for 1USD.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998199420/d1736ed4-3967-467d-8c0f-27ad0292187c.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998229823/282e5150-ce26-49d6-b927-893695601506.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
5. Choose the SNS making sure it is created already or we can create freshly to attach the email id to trigger the mail if the Billing exceeds the threshold.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998263957/e8c1df4f-2a39-4981-a59a-2cc0214c1f5c.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
6. We can review and create the alarm. We can view the final board for the alert created.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998300450/afdd57f5-2994-40ec-9aec-51160d4c6fa0.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1707656636374/e81de752-a56b-47c6-96a5-495d0b0fd865.png align="center")
    
7. We can add the connection from CloudWatch to Grafana Cloud.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685999628453/9013f91b-97c3-47fb-bcda-7fb7a8c425ea.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
8. Add the AWS resources to integrate with Grafana Cloud.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685999669025/f4b0dc4b-30ed-4599-b31c-accee9863459.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
9. Navigate the Grafana cloud dashboard and add the Billing/Usage to view the billing alert that we set up above.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998619631/117a78d8-47ec-4b77-8171-168ecb9da967.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
10. We can now view the Billing dashboard on Grafana cloud.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998694999/c10e8939-a0df-44f7-bd8b-23abb49567ec.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
11. We can set up the Alert rules by navigating to Alerts & IRM on the console. Click on the alert rules.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685998792055/23039c97-5f52-4ad2-abcf-981fd37b889f.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
12. Select the CloudWatch option and then create an alert.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685999068381/9d08cf91-aff9-4304-a82c-258d0899238a.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685999116155/54c7ca84-430b-43e3-9b34-a596c568e44b.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
13. Modify the alert rule to create the AWS Billing alert.
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685999226901/6a42c3f0-fbe0-4ddd-a477-72f31f762343.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1685999270055/bfe4b6e0-fdab-4480-94de-1055dc543ea5.png?auto=compress,format&format=webp&auto=compress,format&format=webp align="left")
    
14. We can get the alert when the billing of AWS resources usage increases.
    

Thanks for reading my article. Have a nice day.
