Issues trying to SSH into a fresh EC2 instance with Paramiko

后端 未结 5 2379
执念已碎
执念已碎 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:47

    I seem to have figured this out by trial and error. Even though the instance status is "running" according to boto, there is a delay for when it will actually allow an SSH connection. Adding a "time.sleep(30)" before the "ssh.connect(...)" seems to do the trick for me, though this may vary.

提交回复
热议问题