Section 01: Setting Ip AWS EC2 Instances
- Login to AWS Management Console: Navigate to the EC2 dashboard.
- Launch Instance: Click on "Launch Instance" and choose an AMI (Amazon Machine Image) based on your preferred OS.
- Instance Type: Select an appropriate instance type (e.g., t2.micro for testing).
- Configure Instance Details: Set network and subnet. Ensure Auto-assign Public IP is enabled.
- Add Storage: Default settings are usually sufficient for Grafana.
- Add Tags: Optional, for resource identification.
- Configure Security Group: Open ports for HTTP (80) and SSH (22) from your IP address.
- Review and Launch: Review settings and launch the instance.
- Key Pair: Create a new key pair, download it, and keep it secure.
Section 02: Configuring Security Groups in AWS
- Edit Inbound Rules: You will need to set inbound rules when creating a connection between the Grafana server and the MySQL server.
Grafana Server Details:
Public IP: 54.67.123.98
Private IP: 172.10.8.1
MySQL Server Details:
Public IP: 54.128.34.56
Private IP: 172.10.8.2
- Add below rules:
HTTP 80 172.0.0.0/8
HTTPS 443 172.0.0.0/8
Custom TCP 3000 172.0.0.0/8
MySQL 3306 172.0.0.0/8
Section 03: Installing Grafana Cloud on the EC2 Server
Here I’m using the Amazon Linux 2023 server and I’m going to install Grafana OSS.
- Install Grafana from the RPM repository.
To install Grafana from the RPM repository, complete the following steps
1.1 Import the GPD key:
# wget -q -O gpg.key https://rpm.grafana.com/gpg.key
# sudo rpm --import gpg.key
1.2 Create /etc/yum.repos.d/grafana.repo with the following content
[grafana]
name=grafana
baseurl=https://rpm.grafana.com
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://rpm.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
1.3 To prevent beta versions from being installed, add the following exclude line to your .repo file
exclude=*beta*
1.4 To install Grafana OSS, run the following command
# sudo dnf install Grafana
- Start the Grafana Server
2.1 Start the Grafana server with systemd
# sudo systemctl daemon-reload
# sudo systemctl start grafana-server
# sudo systemctl status grafana-server
2.2 To verify the service is running, run the following command
# sudo systemctl status grafana-server
- Sign in to Grafana
To sign in to Grafana for the first time, follow the steps:
3.1 Open your web browser and go to http://your_public_ip:3000
3.2 On the sign-in page use ‘admin’ for the username and password
3.3 Click sign in and change the password.
Section 04: Create a Connection Between Grafana Server and MySQL Server
Here I have an AWS EC2 RedHat server that installed MySQL.
- Create a user called “grafana”
mysql> create user ‘grafana’@Grafana_server_private_IP’ identified by 'password';
- Grant privileges
mysql> grant all privileges on database_name.* to ‘grafana’@Grafana_server_private_IP’;
mysql> flush privileges;
Section 05: Create a Data source in Grafana
Top comments (0)