Reverse proxy On Aws With help of Ansible

In this blog we will see how we can create a load balancer setup or reverseproxy setup on Aws cloud with the help of ansible and with help on ansible we will retrive ip of ec2 instance dynamically and automate whole process.

For this we have to setup ansible to launch ec2 instance with dynamic inventory.

pip3 install boto3   //assuming python3 is installed
  • For authentication to the AWS account, create one IAM user that has less privileged than the root account. The AWS_ACCESS_KEY and AWS_SECRET key are passed explicitly through an Ansible so this keys either we can create a file with .boto extension we can provide key here or we can provide a var file and save our keys there .
vi ~/.botto
vi keys.yml
https://raw.githubusercontent.com/A-zish/Ansible_Ec2/master/ec2.pyhttps://raw.githubusercontent.com/A-zish/Ansible_Ec2/master/ec2.ini
chmod +x ec2.py
chmod +x ec2.ini
ansible all --list-hosts
vim /etc/ansible/ansible.cfg
ansible-playboook final.yml