EC2 인스턴스에서 ssh 명령을 실행하는 데 boto3을 사용하려고합니다. 나는이 가이드 읽어 http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/troubleshooting-remote-commands.html 을 나는 그러나 나는 오류 메시지가 그들이 거기에 쓴의 모든 것을 유지 않았다SSM에서 EC2 인스턴스로 명령을 보내지 못했습니다.
>>>import boto3
>>> ec2 = boto3.client('ssm')
>>> a = ec2.send_command(InstanceIds=['i-0d5e16f6'], DocumentName='AWS-RunShellScript', Comment='abcdabcd', Parameters={"commands":["ifconfig"]})
출력 :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 253, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 543, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidInstanceId: An error occurred (InvalidInstanceId) when calling the SendCommand operation:
내가 함께 명령을 보내려고하는 경우 awscli 나는 같은 문제가 발생합니다 :
aws ssm send-command --instance-ids "i-0d5e16f6" --document-name "AWS-RunShellScript" --comment "IP config" --parameters commands=ifconfig --output text
An error occurred (InvalidInstanceId) when calling the SendCommand operation:
어떤 사람은 그것을 해결하는 방법을 알고 있습니까?
인스턴스가 다른 지역에 있습니까?SDK 및/또는 CLI 도구로 올바른 AWS 계정 및 지역을 구성했는지 확인하십시오. –