Day 73 of 90 Days of DevOps Challenge: Setting up Grafana
Task 1: Setting Up Grafana on AWS EC2
Step 1: Launch an EC2 Instance
Log in to the AWS Management Console.
Navigate to the EC2 Dashboard.
Click on "Launch Instance."
Select an Amazon Machine Image (AMI): Choose a suitable AMI, such as Amazon Linux 2 or Ubuntu.
Choose an Instance Type: Select an instance type (e.g., t2.micro) and click "Next."
Configure Instance: Keep the default settings or adjust as needed.
Add Storage: You can keep the default storage size.
Configure Security Group:
Create a new security group.
Add a rule to allow HTTP (port 80) and Grafana (default port 3000).
Allow SSH (port 22) from your IP for remote access.
Review and Launch: Review your settings and launch the instance.
Step 2: Connect to Your EC2 Instance
Use SSH to connect to your instance:
ssh -i /path/to/your-key.pem ec2-user@your-ec2-public-dns
Step 3: Install Grafana
For Amazon Linux 2 or Ubuntu, follow these commands:
Update the package repository:
sudo yum update -y # For Amazon Linux sudo apt update -y # For Ubuntu
Install Grafana:
# For Amazon Linux sudo yum install -y https://dl.grafana.com/oss/release/grafana-9.4.7-1.x86_64.rpm # For Ubuntu echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list sudo apt install -y software-properties-common wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - sudo add-apt-repository -y ppa:grafana/stable sudo apt update -y sudo apt install -y grafana
Step 4: Start and Enable Grafana
Start Grafana service:
sudo systemctl start grafana-server
Enable Grafana to start on boot:
sudo systemctl enable grafana-server
Step 5: Access Grafana
Open your web browser and go to:
http://your-ec2-public-dns:3000
Log in using the default credentials:
Username: admin
Password: admin (you will be prompted to change it on first login)
Step 6: Configure Data Sources and Dashboards
- After logging in, you can add data sources like Prometheus, InfluxDB, or any other supported databases.
Create dashboards and start visualizing your data!