Skip to main content

Posts

Showing posts from January, 2022

AWS RDS IAM DB Authentication

Create AWS RDS MySQL DB: aws rds create-db-instance \ --db-instance-identifier test-mysql-instance \ --db-instance-class db.t3.micro \ --engine mysql \ --master-username admin \ --master-user-password secret99 \ --allocated-storage 20 \ --enable-iam-database-authentication Create user in DB as follows: CREATE USER jane_doe IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS'; Connect to MySQL DB using IAM DB Authentication: RDSHOST="test-mysql-instance.abcdef123456.us-west-2.rds.amazonaws.com" TOKEN="$(aws rds generate-db-auth-token --hostname $RDSHOST --port 3306 --region us-west-2 --username jane_doe )" mysql --host=$RDSHOST --port=3306 --ssl-ca=[file_path]/global-bundle.pem --enable-cleartext-plugin --user=jane_doe --password=$TOKEN Link to download certificate: https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem N...

How to create a Python virtual environment in Ubuntu?

Run the following commands: >  sudo apt update >  sudo apt install python3 >  python3 -V >  sudo apt install python3-pip >  pip3 -V >  pip3 install virtualenv >  virtualenv env >  source env/bin/activate (env) > python -V Python 3.10.1 (env) > pip -V pip 21.3.1 from /home/user/env/lib/python3.10/site-packages/pip (python 3.10) (env) > deactivate Other way of creating virtual environment: >  python3.10 -V Python 3.10.1 > python3.10 -m venv venv1 > source  venv1/bin/activate (venv1) > python -V Python 3.10.1 (venv1) > pip -V pip 21.2.4 from /home/user/venv-1/lib/python3.10/site-packages/pip (python 3.10) (venv1) > deactivate > >  python -V Python 3.8.10 >  python -m venv venv2 >  source  venv2/bin/activate (venv2) >  python -V Python 3.8.10 (venv2) >  pip -V pip 20.0.2 from /home/user/venv-2/lib/python3.8/site-packages/pip (python 3.8) (ve...