Issues trying to SSH into a fresh EC2 instance with Paramiko

后端 未结 5 2441
执念已碎
执念已碎 2021-02-14 14:28

I\'m working on a script that spins up a fresh EC2 instance with boto and uses the Paramiko SSH client to execute remote commands on the instance. For whatever reason, the Param

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-14 14:38

    Why not use boto.manage.cmdshell instead?

    cmd = boto.manage.cmdshell.sshclient_from_instance(instance,
                                                       key_path,
                                                       user_name='ec2_user')
    

    (code taken from line 152 in ec2_launch_instance.py)

    For available cmdshell commands have a look at the SSHClient class from cmdshell.py.

提交回复
热议问题