作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
以下是我从 python 运行以在 aws ec2 实例中执行命令的代码
import boto3
ec2 = boto3.client('ssm',region_name='us-east-1',aws_access_key_id='xxxxxxxxxxxxxxx',aws_secret_access_key='xxxxxxxxx')
a = ec2.send_command(InstanceIds=ids, DocumentName='AWS-RunShellScript', Comment='abcdabcd', Parameters={"commands":["ifconfig"]})
但它给出了以下错误
InvalidInstanceId: An error occurred (InvalidInstanceId) when calling the SendCommand operation:
最佳答案
以下情况可能会导致此错误消息:
您需要登录 AWS EC2/SSM 控制台并确保您尝试管理的实例显示在SYSTEMS MANAGER SHARED RESOURCES - Managed Instances 列表,并且它们显示 Ping 状态 在线。如果不是,您需要在尝试向相关实例发送命令之前解决该问题。
关于python - 无效的实例 ID : An error occurred (InvalidInstanceId) when calling the SendCommand operation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47034797/
我是一名优秀的程序员,十分优秀!