python3 ./postgreSQL-intial.py
python -m postgreSQL-intial
# ModuleNotFoundError: No module named 'pymysql
virtualenv /opt/ansible/env39 -p python3.9
. /opt/ansible/env39/bin/activate
You have to install python package (in your virtualenv) before importing them
pip3 install pymysql
#or
pip3.9 install -r requirements.txt
Google gave me :
Missing config
import boto3
from botocore.config import Config
my_config = Config(
region_name = 'us-east-1',
signature_version = 'v4',
retries = {
'max_attempts': 10,
'mode': 'standard'
}
)
# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm.html
ssm_client = boto3.client('ssm', config=my_config)
# or simpler
ssm_client = boto3.client('ssm', region_name="us-east-1")
TODO
Assuming the should be a json at http://project-env.cluster-qmcy3ndkwlkd.eu-west-1.rds.amazonaws.com/project-env/service_name with a service name for get_service_name
Moreover there might be an issue project-env.cluster-qmcy3ndkwlkd.eu-west-1.rds.amazonaws.com is refering to eu-west-1 but there is region_name="us-east-1" in python file
I cannot ping both hosts :
- project-env.cluster-qmcy3ndkwlkd.us-east-1.rds.amazonaws.com
- project-env.cluster-qmcy3ndkwlkd.eu-west-1.rds.amazonaws.com
So it my be the PetClinic service mysql database that I should have created previously AKS. But even thougt mysql should no be availble from external world.
how-to-create-mysql-user-accounts-and-grant-privileges
cur.execute('GRANT ALL PRIVILEGES ON "{}".* TO "{}";'.format(service, DB_USER))
GRANT SUPER ON *.* TO nabla@'localhost' IDENTIFIED BY 'nabla';
python3 ./mySQL.py
You have to install python postgresql package (in your virtualenv) before importing them
pip3 install py-postgresql has less star
pip3 install psycopg2==2.9.2
#No module named 'ConfigParser'
pip install configparser
# https://www.journaldunet.fr/web-tech/developpement/1497411-comment-corriger-l-erreur-error-pg-config-executable-not-found-en-python/
sudo apt install libpq-dev
sudo apt-get install python3.9-dev
pip3 install psycopg2==2.9.2
pip3 install psycopg2-binary==2.9.2
#or
pip3.9 install -r requirements.txt
I found a python driver which looks very similar to mysql https://py-postgresql.readthedocs.io/en/latest/driver.html#establishing-a-connection
python3 ./postgreSQL.py
python -m postgreSQL
- There is for sure refactoring to be done to manage both database.
- mysqlpass is not encrypted
This SSM service seems to be an API to get inventory on AWS. I would expect a DevOps not to re invent the wheel and get direct access to this API directly. There is CMDB tools for inventory servicenow, Ansible get a module to access AWS and have basic [cmdb(https://ansible-cmdb.readthedocs.io/en/latest/usage/)].
I do not know terraform but I would expect (even more that Ansible), to be able to retrieve all AWS ressources directly and securely...