3

I'm trying to write a script that will take a single string (machine name) and use Amazon API to find that machine and get the DNS and SSH into the machine. If it were a bash script I could simply put in an ssh command and it would create the connection and the user wouldn't notice anything. How do I do that in Python though? I essentially want the script to end and the terminal to SSH into the machine.

1 Answer 1

2

For querying EC2 resources, use the boto library.

For running the ssh, use the subprocess.call (no need to end the script though).

import subprocess
addr = '10.20.30.40'
subprocess.call([ 'ssh', addr ])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.