问题描述
朋友们,我在尝试使用 terraform 创建 Spot 实例时遇到以下错误。
"错误:请求 Spot 实例时出错:MaxSpotInstanceCountExceeded: 超出最大 Spot 实例数 状态代码:400,请求 ID:19c590fd-c352-4bbd-8915-678ac3e32474"
我已经在 aws 控制台中检查了我的限制及其显示 32vcpu(image3),而且目前我没有任何正在运行的 Spot 实例模板或正在运行的实例 (image2)。我的问题是,我可以直接通过 aws 控制台创建现场实例,但不能通过 terraform v0.14.5 (image1) 创建。我在这篇文章中附上了所有截图,以便更好地了解。我真的不知道如何解决这个问题,甚至 aws 支持团队也只是要求我检查我已经完成的限制。因此,此社区对此案例的任何帮助都非常值得赞赏。
解决方法
朋友 - 最后,我找到了解决此问题的方法。此错误的主要原因是我在“createinstance.tf”文件中提到的“block_duration_minutes = 120”。因为,我为我的实例指定了 AZ,所以我不可能提到“block_duration_minute”。因此,我应该删除此参数以使其工作。阅读有关此https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/spot_instance_request
的更多信息感谢支持。