InvalidInstanceId:调用SendCommand操作时发生错误(InvalidInstanceId) [英] InvalidInstanceId: An error occurred (InvalidInstanceId) when calling the SendCommand operation

查看:457
本文介绍了InvalidInstanceId:调用SendCommand操作时发生错误(InvalidInstanceId)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我从python运行以在aws ec2实例中执行命令的代码

The below is the code which i am running from python to execute commands in aws ec2 instance

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: 


推荐答案

以下情况可能导致此错误消息:

The following scenarios can result in this error message:


  • 实例ID无效(在您确认不是的实例中)

  • 实例位于不同的区域(在您已验证的注释中不是)

  • 实例当前未处于运行状态

  • 实例没有安装 AWS SSM代理,并且

  • Instance id is invalid (in the comments you have verified it isn't)
  • Instance is in a different region (in the comments you have verified it isn't)
  • Instance is not currently in the Running state
  • Instance does not have the AWS SSM agent installed and running.

您需要登录到AWS EC2 / SSM控制台,并确保显示您要管理的实例 SYSTEMS MANAGER SHARED RESOURCES - Managed Instances 列表中,并且它们显示的 Ping状态在线。如果没有,则需要先解决此问题,然后再尝试将命令发送到有问题的实例。

You need to login to the AWS EC2/SSM console and make sure the instance(s) you are trying manage show up in the SYSTEMS MANAGER SHARED RESOURCES - Managed Instances list, and that they show a Ping status of Online. If not, you need to fix that before trying to send commands to the instance(s) in question.

这篇关于InvalidInstanceId:调用SendCommand操作时发生错误(InvalidInstanceId)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆