'How to connect to ec2 instance using boto3

I have an ec2 instance running which is used to run sql command to get results from a rds residing into private subnet. Using python-boto3 I want to connect to ec2 instance using session manager and run few queries

Is there any way to achieve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source