我有以下代码:
$result = $ec2->runInstances(array(
// ImageId is required
'ImageId' => $image,
// MinCount is required
'MinCount' => 1,
// MaxCount is required
'MaxCount' => 1,
'KeyName' => $key,
'SecurityGroupIds' => array($sg),
'InstanceType' => $type,
'Placement' => array(
'AvailabilityZone' => $az,
),
'Monitoring' => array(
// Enabled is required
'Enabled' => false,
),
'SubnetId' => $subnet,
'PrivateIpAddress' => $ip,
'ClientToken' => 'string',
'AdditionalInfo' => 'string',
));
$instanceIds = $result->getPath('Instances/*/InstanceId');
$ec2->waitUntilInstanceRunning(array(
'InstanceIds' => $instanceIds,
));
这在我第一次运行时没有任何问题。初次运行后,我从 EC2 控制台终止了该实例。现在每次尝试创建新实例时都会出现以下错误。
A resource entered into an invalid state of "terminated" while waiting with the "InstanceRunning" waiter.
我不明白为什么服务员正在查看旧的实例 ID,这是否以某种方式持续存在?
我还有什么需要补充的吗?