我有这个 Terraform 文件 -
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.23"
}
}
required_version = ">= 1.2.0"
}
provider "aws" {
region = "us-west-2"
}
resource "aws_instance" "app_server" {
ami = "ami-830c94e3"
instance_type = "t3.nano"
}
当我运行时terraform init && terraform apply
出现此错误:
╷
│ Error: creating EC2 Instance: InvalidParameterCombination: Enhanced networking with the Elastic Network Adapter (ENA) is required for the 't3.nano' instance type. Ensure that you are using an AMI that is enabled for ENA.
│ status code: 400, request id: 1d85ba43-ffde-4840-9acb-8ac87c13fb24
│
│ with aws_instance.app_server,
│ on main.tf line 16, in resource "aws_instance" "app_server":
│ 16: resource "aws_instance" "app_server" {
│
╵
两个问题:
答案1
aws ec2 describe-instance-types --filters 名称=network-info.ena-support,值=supported,unsupported
添加 --query 'InstanceTypes[].InstanceType' 可能更简洁
您需要交叉引用这些内容以及该地区可用的内容
aws ec2 describe-instance-type-offerings --location-type 区域 --filters 名称=位置,值=地区