This mini project Deploy an AWS EC2 instance with Grafana, Prometheus stack
- AWS Account
- Linux or MacOS shell
- Python 3.8 or newer
- Terraform
- Ansible
- AWS CLI tools
Make sure you've got both the private key and public key ready to be used
$HOME/.ssh/id_rsa
$HOME/.ssh/id_rsa.pub
One can generate key pair with following command
$ ssh-keygen
More details at ssh.com
Make sure to have a valid AWS CLI profile set up named terransible
$ cat $HOME/.aws/credentials
[terransible]
aws_access_key_id = CHANGE-ME
aws_secret_access_key = CHANGE-ME
region = CHANGE-ME
Clone the repository
git clone [email protected]:jpuris/terraform-ansible-example.git
Run the terraform plan
$ cd terraform
$ terraform init
$ terraform plan
Apply the terraform infrastructure
$ terraform apply
SSH into EC2
$ echo "ssh ubuntu@`grep aws ../ansible/hosts` -i ~/.ssh/id_rsa"
Grafana URL
$ echo "`grep aws ../ansible/hosts`:3000"
Prometheus URL
$ echo "`grep aws ../ansible/hosts`:9090"
Remove the created infrastructure
$ terraform destroy
Distributed under the MIT License. See LICENSE.txt for more information.