Welcome back to the #90DaysOfDevOps Challenge. On Day 78, weâll explore the powerful capabilities of Grafana Cloud for monitoring your infrastructure and cloud resources. Grafana Cloud offers a comprehensive monitoring solution that allows you to gain valuable insights into the performance and health of your systems. Letâs dive in and learn how to set up alerts for EC2 instances and AWS Billing Alerts using Grafana Cloud.
Grafana Cloud: A Comprehensive Monitoring Solution
Grafana Cloud is a robust and scalable monitoring platform that provides a wide range of monitoring capabilities for your infrastructure, applications, and cloud resources. With Grafana Cloud, you can consolidate all your monitoring needs into a single platform, allowing you to gain real-time visibility into the performance and health of your systems. The platformâs intuitive interface and powerful features make it an ideal choice for DevOps teams to effectively monitor their environments.
Task: Setting Up Alerts for EC2 Instances and AWS Billing Alerts
Step 1: Create an EC2 Instance â Start by creating an EC2 instance in your AWS environment. This instance will be monitored using Grafana.
Step 2: Set up Grafana Cloud Console â If you havenât set up Grafana Cloud yet, follow the steps in my previous blog post on how to set up Grafana Cloud.
Step 3: Connect Data to AWS
On the Grafana Cloud home page, navigate to the âConnections/Add new connectionâ section.
Click on âAWSâ to access the setup for AWS account integration.
Step 4: Select CloudWatch Metrics
- In the dashboard, select CloudWatch metrics for integration between AWS and Grafana Cloud.
Step 5: Create AWS IAM Role â For CloudWatch integration, you need to create an AWS IAM Role. Follow the given steps in the screenshot to set up the IAM Role via CloudFormation.
Step 6: Access CloudWatch Metrics Dashboard â After successful integration, go to the home page and open the dashboard. Select the CloudWatch Metrics dashboard to view visualized data with real-time tracking.
Step 7: Set Up Alerts for CPU Utilization â Now we will set up an alert for CPU utilization when it reaches 75%.
Click on âCreate Alert Ruleâ for CPU utilization above 75%.
Select the metric
as_ec2_cpuutilization_maximum
, then select the instance ID, and set the threshold value to 75%.Run the query to check the output.
Click âSave Ruleâ to save the alert rule.
Step 8: Configure Alerting Emails â To receive alert notifications via email, follow these steps:
Click on âManage Contact Points.â
Edit the
grafana-default-email
contact point.
Put your email address in the âAddressâ field and click âTestâ for verification.
You will receive a test alert email to confirm the setup.
Step 9: Set Up Notification Policies
Click on âManage Notification Policies.â
Select the label and value for the notification (e.g., âalertâ and âcriticalâ).
Choose the contact point you previously created for alerting emails.
Step 10: Set Up Alerts for Billing In this step, we will set up an alert to avoid overspending on AWS services. Weâll create an alert if the estimated billing charges go above $10.
Select âManage Alert Rule.â
Choose the metric
aws_billing_estimated_charges_average
and sum them.Set the threshold value to 5$.
- Add a new notification policy for billing above $5.
Congratulations! Youâve now set up monitoring and alerting for your EC2 instances and AWS billing in Grafana Cloud. With Grafana Cloudâs powerful monitoring capabilities, you can proactively respond to issues and ensure the optimal performance of your infrastructure.