错误:启动源实例时出错:不支持:当前不支持请求的配置



我正在学习Udemy的Terraform课程'Learn DevOps: Infrastructure Automation with Terraform'。根据练习"terraform 的第一步 - 启动实例",当我运行"instance.tf"时,我收到以下错误。

Error: Error launching source instance: Unsupported: The requested configuration is currently not supported. Please check the documentation for supported configurations.
status code: 400, request id: cbfbb2e8-35bd-4527-8da3-b59506c55b81
on instance.tf line 7, in resource "aws_instance" "example":
7: resource "aws_instance" "example" {

这是我 instance.tf 文件。

provider "aws" {
access_key = "XXXXXXXXXXXXXXXXXX"
secret_key = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
region     = "ap-south-1"
}
resource "aws_instance" "example" {
ami           = "ami-0e175be6acf8b637d"
instance_type = "t2.micro"
}

请帮忙。

代码看起来不错。

请检查此 AMIami-0e175be6acf8b637d是否存在于亚太地区(孟买)

如果没有,您将获得上述错误。

检查区域中的实例类型。就我而言,它确实首先失败了,但是当我检查我在脚本中选择的实例类型时,该实例类型在我指定的区域中不可用。 更改实例类型后,它确实有效。试试看

instance_type = "t3.micro" }

您可以在更正 AMI 详细信息后解决此问题。

最新更新