Grafana Installation Steps on AWS EC2 Instance

Hemant Jain
DevOps and SRE Learning

--

Grafana Installation on Ubuntu EC2 Instance with Security Group Enabled by using shell script.

Grafana is multi-platform open source analytics and interactive visualization software available since 2014. It provides charts, graphs, and alerts for the web when connected to supported data sources. It is expandable through a plug-in system. End users can create complex monitoring dashboards using interactive query builders.

As a visualization tool, Grafana is a popular component in monitoring stacks,often used in combination with time series databases such as Prometheus and Graphite.

In this post, you will learn how to install the Grafana, by using shell script AWS EC2 Ubuntu Instance Server.

Step1: Spin up an EC2 Instance on AWS by logging in your dev/prod account

Step2: Once the EC2 Instance is up and running,we would be using the Public DNS (IPv4) or IPv4 Public IP to login into server using credentials, and switch the user to root.

Mobaxterm SSH Login Screen using IAM Access and Secret Key
Mobaxterm EC2 Instance Login Screen

Step3: Open any text editor and create the grafanainstallation.sh shell script file.And paste the below code and save using ESC+wq Command on text editor.

#!/bin/bash
echo ‘deb
https://packages.grafana.com/oss/deb stable main’ >> /etc/apt/sources.list
curl
https://packages.grafana.com/gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install grafana
systemctl daemon-reload
systemctl start grafana-server
systemctl enable grafana-server.service

Step4: Change the permission of file by using the command.

chmod +x grafanainstallation.sh

Step5: execute the shell script by using command

./grafanainstallation.sh

Step6: Verify whether Grafana is running or not by using following command

service grafana-server status

If the Grafana Server is not running run the below command to start it.

service grafana-server start

Step7: Perfect, our Grafana server is in active state and is up and running for the Metrics and Performance Visualization.

Step8: Here, you won’t be able to the grafana dashboard now as the AWS Security Group for the EC2 Instance is not enabled to accept the load for port 3000.Therefore,you must allow the 3000 port in security groups in AWS.

Step9: Take the IP address or DNS of your server and place it on address bar of the any browser along with Grafana port 3000. (we can change the port number)

Step10: By default, Grafana username and password are admin and admin. From the next screen you can get the option to change your password. that is depend on your choice either you can change or not.

Step11: Below is the Grafana Home screen.

Grafana Visualization Dashboard Home Screen

--

--

Hemant Jain
DevOps and SRE Learning

Sr. SRE at Oracle, Ex-PayPal, Ex-RedHat. Professional Graduate Student interested in Cloud Computing and Advanced Big Data Processing and Optimization.