Error: Error launching source instance: Unsupported: The requested configuration is currently not supported

Error: Error launching source instance: Unsupported: The requested configuration is currently not supported

我正在学习 Udemy 的 Terraform 课程“学习 DevOps:使用 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"
}

请帮忙。

代码看起来不错。

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

否则,您将收到上述错误。

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

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

instance_type = "t3.micro" }