相关疑难解决方法(0)

InvalidInstanceId:调用SendCommand操作时发生错误(InvalidInstanceId)

下面是我从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"]})
Run Code Online (Sandbox Code Playgroud)

但它给出了以下错误

InvalidInstanceId: An error occurred (InvalidInstanceId) when calling the SendCommand operation: 
Run Code Online (Sandbox Code Playgroud)

python amazon-ec2 amazon-web-services boto3

11
推荐指数
2
解决办法
7563
查看次数

标签 统计

amazon-ec2 ×1

amazon-web-services ×1

boto3 ×1

python ×1