How to Deploy Grafana on Debian-like Linux in AWS using Ansible.
Preface.
Grafana is an open source, feature rich metrics dashboard and graph editor for Graphite, Elasticsearch, OpenTSDB, Prometheus, and InfluxDB. In this article, we will install it in the AWS cloud using Ansible.
Step 1. Create an instance with Ubuntu server installed.
For testing purposes, you can select t3.small and 30 Gb SSD storage.
Step 2. Security Group
Create a security group with open 22 and 3000 ports. We need 22 port for ssh access and 3000 for access Grafana dashboard via a web browser.
Step 3.
Install Ansible on your local computer.
Step 4.
Clone this repo:
$ git clone https://github.com/PharosProduction/tutorial-aws-grafana.git
Step 5.
Modify ./tutorial-aws-grafana/ansible/hosts file:
You should add your pem file location after “ansible_ssh_private_key_file= ” (line 3) and replace 54.77.154.230 to your AWS instance public IP (line 6)
Step 6. Run Ansible playbook
$ ansible-playbook -b grafana.yml
In this playbook, we install apt-transport-https, which is required by grafana, then add grafana repository and gpg key, install grafana-server and finally start service and enable it after an instance restart.
Ansible can show a warning. Nevermind.
Step 7. Logging in for the first time
To run Grafana open your browser and go to http://your-aws-instance-ip:3000/. 3000 is the default HTTP port that Grafana listens to. There you will see the login page.
The default username is admin and the default password is admin. When you log in for the first time you will be asked to change your password. We strongly encourage you to follow Grafana’s best practices and change the default administrator password.
You can find all necessary files here
Thank you for reading!