#90DaysOfDevOps Challenge - Day 73 - Grafana Setup

#90DaysOfDevOps Challenge - Day 73 - Grafana Setup

Welcome back to the #90DaysOfDevOps Challenge! On Day 73, we'll guide you through setting up Grafana in your local environment on an AWS EC2 instance. Grafana is a powerful tool for monitoring and visualization, and having it locally installed can be highly beneficial for development and testing purposes. Let's get started with the setup!

Task 1: Setup Grafana in Your Local Environment on AWS EC2

We'll follow the steps outlined in the Official Grafana Documentation

Step 1: Launch an AWS EC2 Instance

  1. Log in to your AWS Management Console.

  2. Navigate to the EC2 service.

  3. Click on "Launch Instance" to create a new instance.

  4. Select an appropriate Amazon Machine Image (AMI) for your EC2 instance. Choose an image that supports Grafana, like Amazon Linux or Ubuntu.

  5. Choose an instance type based on your requirements.

  6. Configure instance details such as the VPC, subnet, security group, and any other necessary settings.

  7. Add storage if needed, and configure tags and security settings as per your requirements.

  8. Review and launch the instance.

Step 2: Connect to Your EC2 Instance

  1. Once the instance is launched, select it from the EC2 dashboard.

  2. Click on "Connect" to get connection instructions.

  3. Follow the instructions to connect to your instance using your preferred method.

Step 3: Install Grafana

Complete the following steps to install Grafana from the APT repository:

  1. To install the required packages and download the Grafana repository signing key, run the following commands:

     sudo apt-get install -y apt-transport-https
     sudo apt-get install -y software-properties-common wget
     sudo wget -q -O /usr/share/keyrings/grafana.key https://apt.grafana.com/gpg.key
  2. To add a repository for stable releases, run the following command:

     echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
  3. To add a repository for beta releases, run the following command:

     echo "deb [signed-by=/usr/share/keyrings/grafana.key] https://apt.grafana.com beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
  4. Run the following command to update the list of available packages:

     # Updates the list of available packages
     sudo apt-get update
  5. To install Grafana OSS, run the following command:

     # Installs the latest OSS release:
     sudo apt-get install grafana

Step 4: Start and Enable Grafana Service

  1. Start the Grafana service:

     sudo systemctl start grafana-server
  2. Enable the Grafana service to start on boot:

     sudo systemctl enable grafana-server

Step 5: Access Grafana Web Interface

  1. By default, Grafana listens on port 3000. Open port 3000 in the security group associated with your EC2 instance to allow incoming traffic.

  2. Open your web browser and access Grafana using your EC2 instance's public IP address or DNS name, followed by port 3000 (e.g., http://your-ec2-public-ip:3000).

Step 6: Log in to Grafana

  1. On the sign-in page, enter admin for username and password.

  2. The first time you access Grafana, you will be prompted to set up an admin password.

  3. Set your admin password and log in with the default username "admin" and the password you just set.

Step 7: Explore Grafana

  1. Once you log in, you will be directed to the Grafana dashboard.

  2. Explore the Grafana interface and start creating your own dashboards to visualize and monitor data from various data sources.

Congratulations! You've successfully set up Grafana in your local environment on an AWS EC2 instance. Now, you can leverage Grafana's powerful visualization capabilities to monitor and analyze your data efficiently.

Stay tuned for Day 74 of the #90daysofdevops challenge, where we'll learn how to connect EC2 Instances with Grafana.

Did you find this article valuable?

Support Esteban Moreno by becoming a sponsor. Any amount is appreciated!