我正在尝试在 Terraform 中创建一个点实例,并且 terraform 代码似乎很好,但我一直收到一条错误消息,说MaxSpotInstanceCountExceeded。
注意:现在这只是一个测试,因此我不包括安全组、IP 等。
我已采取的步骤:
- 检查我在控制台中创建了 0 个现场实例请求。
- 尝试登录控制台并创建 Spot 实例请求。它工作得很好。
- 取消了 Spot 实例请求以确保我现在有 0 个 Spot 实例请求。
- 现在我尝试使用下面的 terraform 脚本创建几乎相同的点实例,但出现错误:MaxSpotInstanceCountExceeded
有谁知道为什么 Terraform(或者可能是 AWS?)不允许我使用 terraform 脚本创建现场实例,但它在控制台上工作得很好?
谢谢!
provider "aws" {
profile = "terraform_enterprise_user"
region = "us-east-2"
}
resource "aws_spot_instance_request" "MySpotInstance" {
# Spot Request Settings
wait_for_fulfillment = "true"
spot_type = "persistent"
instance_interruption_behaviour = "stop"
# Instance Settings
ami = "ami-0520e698dd500b1d1"
instance_type = "c4.large"
associate_public_ip_address = "1"
root_block_device {
volume_size = "10"
volume_type = "standard"
}
ebs_block_device {
device_name = "/dev/sdb"
volume_size = "50"
volume_type = "standard"
delete_on_termination = "true"
}
tags = {
Name = "MySpotInstance"
Application = "MyApp"
Environment = "TEST"
}
}