Day 73: Title: Setting Up Grafana on AWS EC2: A Step-by-Step Guide


2 min read

Day 73: Title: Setting Up Grafana on AWS EC2: A Step-by-Step Guide

Now that we've grasped the fundamentals of Grafana, let's dive into some hands-on experience by setting it up in your local environment on AWS EC2. In this tutorial, we'll walk through the process step-by-step, ensuring a smooth installation and configuration of Grafana for your monitoring needs.


  1. AWS Account: Ensure you have an active AWS account to create an EC2 instance.

  2. SSH Key Pair: Generate an SSH key pair to securely connect to your EC2 instance.

  3. Basic Knowledge: Familiarity with AWS EC2 and Linux command line will be helpful.

Step 1: Launch an EC2 Instance

  • Log in to your AWS Management Console and navigate to the EC2 dashboard.

  • Click on "Launch Instance" and choose a suitable Amazon Machine Image (AMI), preferably based on Linux (e.g., Amazon Linux, Ubuntu).

  • Select an instance type, configure instance details, add storage, and configure security groups to allow inbound traffic on port 22 (SSH) and port 3000 (Grafana).

  • Launch the instance and associate it with your SSH key pair.

Step 2: Connect to Your EC2 Instance

  • Once the instance is running, note down its public IP address.

  • Open your terminal or SSH client and use the following command to connect to your EC2 instance:

ssh -i /path/to/your/key.pem ec2-user@public_ip_address

Step 3: Install Grafana

  • Update the package repository:
sudo apt-get update -y
  • Download and install Grafana repository configuration:

echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get install grafana

Step 4: Start Grafana Service

  • Start the Grafana service and enable it to start on boot:
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Step 5: Access Grafana Web Interface

  • Open a web browser and navigate to your EC2 instance's public IP address followed by port 3000 (http://public_ip_address:3000).

  • Log in to Grafana using the default credentials (admin/admin).

  • Upon login, you'll be prompted to change the password. Follow the instructions to set a new password.

Step 6: Configure Data Sources and Dashboards

  • Once logged in, configure data sources (e.g., Prometheus, InfluxDB, Graphite) to start visualizing your metrics.

  • Explore the Grafana UI to create dashboards, panels, and alerts according to your monitoring requirements.


Congratulations! You've successfully set up Grafana on an AWS EC2 instance and are ready to leverage its powerful monitoring and visualization capabilities. With Grafana, you can now monitor your systems, applications, and services effectively, gaining valuable insights to drive informed decisions and ensure optimal performance.

Happy monitoring! ๐Ÿš€