how to do 'knife ec2 server create' from python script
Question: I am trying to convert my ant script to python. The ant script runs knife ec2
server create command. What is the best practice to run knife ec2 server
create from Python?

BTW, is python the right scripting technology for automation?


Answer: I'm not familiar with a Python interface for knife, but I see no reason for
this not to work:

    
    
    import sh
    
    sh.knife.ec2.server.create(r='role[x]', I='ami-xxxxxxx', f='t2.micro', aws-access-key-id=ACCESS_KEY, aws-secret-access-key=SECRET_KEY)
    

You'll need to `pip install sh` for it, so you can also use subprocess for it
instead if you don't want extra dependencies:

    
    
    import subprocess
    
    subprocess.Popen('knife ec2 server create ...', shell=True)
    

If I were you, i'd write a small client for running knife commands more
comfortably though, as if you use knife, this is probably not the only command
you're going to run. `sh` would be ideal for that.

Regarding your second question, you should open another issue for it.

