An Ansible EC2 Playbook for hosting applications on AWS
- Install Python3 and pip:
sudo apt-get install python3 python3-pip
- Install required dependencies:
python3 -m pip install -r ansible-requirements.txt
- Reboot the machine:
reboot
- Copy AWS credentials to
~/.aws/credentials
- To provision the EC2 instance and deploy webserver:
ansible-playbook -v webservers.yml
- To terminate the EC2 instance:
ansible-playbook -v terminate_ec2.yml