Posts

Showing posts with the label Automating EC2 creation - Stopping - Starting using Ansible

Automating EC2 creation - Stopping - Starting using Ansible

Image
  Requirements Requirements (on host that executes modules): python 3 awscli boto - Ansible will connect to AWS using the boto SDK. So, we need to install the boto and boto3 packages. : $ pip3 install boto boto3 add this configuration to the ansible hosts file Here is the  hosts  file: [local] localhost ansible_python_interpreter= /usr/share/python3 you can fallow below commands ro find path  root@ip-172-31-23-165:/home/ubuntu# python3 --version Python 3.10.6 root@ip-172-31-23-165:/home/ubuntu# whereis python 3 python: /usr/share/python3 Note that we set the  ansible_python_interpreter  configuration option to  /usr/share/python3 . The  ansible_python_interpreter  configuration option is usually set per-host as an inventory variable associated with a host. EC2 Creation  create a file named ec2-creation.yml  --- - name: stop EC2 instance   hosts: all   gather_facts: yes   vars:       region: us-eas...