- A project for gathering relevant data from cloud providers API about VMs/etc.
- Relevant data means: what is running where and IPs/etc.
- Install WSL (Windows Subsystem Linux (the easiest way to use Linux in Windows)
-
Clone the repository
git clone https://github.com/iisti/cloud_infra_gather_api_data.git
-
Install Python3 and pip3
sudo apt-get install python3 python3-pip
-
Install virtualenv using pip3
pip3 install virtualenv
-
Create virtual environment
virtualenv cloud_infra_gather_api_data/virtualenv
-
Activate virtual environment
source cloud_infra_gather_api_data/virtualenv/bin/activate # If you get error "virtualenv: command not found", relogin into shell and try again.
-
One can check which virtualenv is in use by:
echo $VIRTUAL_ENV /home/iisti/scripts/cloud_infra_gather_api_data/virtualenv
-
Deactivate (just to know how it's done)
deactivate
-
Install modules
# Remember to activate virtualenv before pip3 install -r requirements.txt
- Create service account for connecting to GCP API.
- One can do this also with "Installed Application".
- Source: https://libcloud.readthedocs.io/en/stable/compute/drivers/gce.htm
- GCP Projcet -> IAM & Admin -> Service Accounts -> Create service account
- Input name.
- Step: Grant this service account access to project (optional)
- User role "Basic: viewer" = Read access to all resources.
- Step: Grant users access to this service account (optional)
- This is not needed.
- Select the new service account and create new key in JSON format.
- Copy/move the credential JSON to this project root and rename it with prefix "credential_", so that the credentials will not be uploaded to GitHub by accident.
- Required information from GCP:
- Service account ID == api_key for Libcloud
- Project ID, this string can be found from GCP Project Dashboard.