I have created a free tier EC2 instance for deploying a docker image. I am planning to do it through a python program that uses the Docker SDK for Python. In the documentation of the package, the connection is made to the docker instance using the following code snippet
client = docker.from_env()
How can I specify the details of my AWS EC2 instance here so that I can connect to it directly and do operations such as deploying a new image, listing active containers, etc?
If it is possible to specify the connection parameters such as my username, password, host address, and server location here, how can I do it by creating secrets for these params in the app?
I tried connecting using the syntax mentioned but I couldn't find how to make the connection to a cloud instance.