2017-09-10 3 views
-1

행운없이 awscli 인터페이스를 사용하여 AWS EC2 인스턴스를 시작하려고합니다. 나는 boto3 라이브러리를 사용할 때awscli 인터페이스를 사용하여 AWS EC2 인스턴스를 시작하려면 어떻게해야합니까?

An error occurred (InvalidInstanceID.NotFound) when calling the StopInstances operation: The instance ID '<my-instance-id>' does not exist 

오전이 같은 오류가 : 나는 다음과 같은 오류가

aws ec2 start-instances --instance-ids <my-instance-id> 

이 내 명령입니다. 내가 무엇이 누락 되었습니까?

답변

2

AWS Command-Line Interface (CLI) 구문은 다음과 같습니다

aws ec2 start-instances --instance-ids i-abcd1234 --region us-west-2 

(사용자가 정의한 기본 영역을 가지고 있다면, 당신은 --region 필요하지 않습니다.)

boto3를 통해 수행 :

import boto3 

ec2 = boto3.client('ec2', region_name = 'us-west-2') 
ec2.start_instances(InstanceIds=['i-abcd1234'])