Now we have to transfer the AWS pem key from local system to the ansible VM.
Third, we need to install python3 for running the ec2.py.
# yum install python3-y
Third, we need to install boto3 library which is python3 SDK for AWS.
Steps
First, we have to configure ansible inventory for AWS. Here we provide path where we put the aws.py file & pem key in inventory path. We also include privilege escalation for root access.
Press enter or click to view image in full size
Now we make both aws.py file & AWS private pem key executable by using below commands:-
# chmod +x ec2.py # chmod 400 <private_key>.pem
Now, we need to install boto3 library which is python3 SDK for AWS.
pip install boto3
Press enter or click to view image in full size
The most important step of this task is to set environment variable for authentication