Boto3 / AWS:创建实例时“ ImageId不存在”

时间:2018-07-18 14:56:29

标签: python amazon-web-services boto3 ami

我已经制作了一个AMI的副本,我正在尝试使用以下代码运行它:

import boto3

instance_id=("i-0e2bbdf4fc43bf6db")

client = boto3.client("ec2",region_name="us-west-2")
ec2 = boto3.resource("ec2")

ec2.create_instances(ImageId="ami-9d623ee5",MinCount=1,MaxCount=1)

返回ClientError:

ClientError: An error occurred (InvalidAMIID.NotFound) when calling the RunInstances operation: The image id '[ami-9d623ee5]' does not exist

问题可能是什么? 谢谢!

1 个答案:

答案 0 :(得分:0)

假设AMI位于同一区域...

您的代码有误:更改为类似于以下内容:

StringIndexOutOfBoundsException: length=0; regionStart=0; regionLength=20