How to SSH and run commands in EC2 using boto3?

前端 未结 6 1984
情深已故
情深已故 2020-12-03 05:02

I want to be able to ssh into an EC2 instance, and run some shell commands in it, like this.

How do I do it in boto3?

6条回答
  •  心在旅途
    2020-12-03 05:45

    Boto provided a way to SSH into EC2 instances programmatically using Paramiko and then run commands. Boto3 does not include this functionality. You could probably modify the boto code to work with boto3 without a huge amount of effort. Or you could look into using something like fabric or ansible which provide a much more powerful way to remotely execute commands on EC2 instances.

提交回复
热议问题