如何通过aws api工具运行不同的实例

时间:2014-02-25 17:46:04

标签: api amazon-web-services amazon-ec2

当我执行命令ec2-describe-availability-zones时,它显示

AVAILABILITYZONE    us-east-1a  available   us-east-1   
AVAILABILITYZONE    us-east-1c  available   us-east-1   
AVAILABILITYZONE    us-east-1d  available   us-east-1

所以......我只能在us-east-1

中运行实例

如果我想在ue-west-1等其他版本中运行实例,我该如何使用其他区域?

我将ami形式从我们 - 东 - 1复制到我们 - 西 - 1 我执行命令 ec2-run-instances ami-526a0662 -n 1 -k USweastOregon -g launch-wizard-2 --monitor

显示

Client.InvalidAMIID.NotFound: The image id '[ami-526a0662]' does not exist

2 个答案:

答案 0 :(得分:1)

AMI是针对特定地区的。如果您想在其他地区使用AMI,则必须先copy it

  

要使用AMI Copy,只需从中选择要复制的AMI即可   在AWS管理控制台中,选择目标区域,然后启动   复制。也可以通过EC2命令行访问AMI Copy   EC2用户指南中描述的接口或EC2 API。一旦   复制完成后,新的AMI可用于启动新的EC2实例   在目的地区域。

新区域的AMI将具有不同的AMI ID。

答案 1 :(得分:0)

您应该使用--region并指定eu-west-1us-west-1

 --region REGION
      Specify REGION as the web service region to use.
      This option will override the URL specified by the "-U URL" option
      and EC2_URL environment variable.