ec2 API如何确定哪个可用区? [英] How does the ec2 API decide which availability zone?

查看:100
本文介绍了ec2 API如何确定哪个可用区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一项服务,该服务可以按需以编程方式启动EC2实例.我想给它最大的机会,它可以随时启动实例,最大程度地减少由于容量不足而导致的失败.实例在一个区域内运行在哪个可用区域无关紧要,只是我有最大的机会启动一个.

I'm writing a service which programmatically starts EC2 instances on demand. I want to give it the best chance of being able to start an instance at any time, minimizing fails due to lack of capacity. It doesn't matter what availability zone the instances run in within a region, just that I have the best chance of starting one.

我想知道,如果在使用api的runInstances方法时不指定放置对象,会不会:

I'm wondering, if I don't specify a placement object when using the runInstances method of the api, will it:

A)在任何具有可用容量的可用区中运行我的新实例

A) Run my new instances in any availability zone which has the capacity available

B)随机选择一个可用区域,如果那里没有可用容量,则失败

B) Randomly pick an availability zone and fail if there isn't any spare capacity there

C)还有其他东西

我的研究表明人们相信它是A)或B),但我无法从aws中找到明确的答案.

My research shows people believing it's A) or B) but I can't find a definitive answer from aws.

如果是A)我想我可以打个电话,然后让aws弄清楚我是否可以拥有该实例.如果是B),我想我应该通过可用区并继续尝试所有方法,直到找到有可用容量的容器为止.

If it's A) I guess I can make one call and leave it to aws to figure out if I can have the instance. If it's B) I guess I should pass in the availability zone and keep trying them all until I find one with spare capacity.

谢谢.

推荐答案

类似于

启动实例时,可以选择指定可用区.如果您未指定可用区,则Amazon EC2将在您使用的区域中为您选择一个.启动初始实例时,建议您接受默认的可用区,这使我们能够根据系统运行状况和可用容量为您选择最佳的可用区. [...]

When you launch an instance, you can optionally specify an Availability Zone. If you do not specify an Availability Zone, Amazon EC2 selects one for you in the region that you are using. When launching your initial instances, we recommend accepting the default Availability Zone, which enables us to select the best Availability Zone for you based on system health and available capacity. [...]

尽管该语言并非100%精确,但我认为我的选项A)是正确的&不指定可用区域意味着Amazon EC2会尽力找到具有可用容量的区域,尽管可能首先应用其他条件.

Although the language isn't 100% precise I take from this that my option A) is correct & not specifying an availability zone means Amazon EC2 will try it's best to find a zone with available capacity, although possibly applying some other criteria first.

这篇关于ec2 API如何确定哪个可用区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆