Terraform-provider-aws: Error launching source instance: ENA must be enabled

Created on 29 Dec 2018  ยท  6Comments  ยท  Source: hashicorp/terraform-provider-aws

_This issue was originally opened by @ackris as hashicorp/terraform#19763. It was migrated here as a result of the provider split. The original body of the issue is below._


Hi
I am trying to automate the instantiation of t3.large instances using Terraform. I am getting stuck with this error upon terraform apply:

Error launching source instance: InvalidParameterCombination: Enhanced networking with the Elastic Network Adapter (ENA) is required for the 't3.large' instance type. Ensure that you are using an AMI that is enabled for ENA.

Has anyone faced this issue? I have found that aws_ami resource provides ena_support parameter, yet it is hitting me with the same error.

Useful Details:

Terraform v0.11.11
+ provider.aws v1.54.0

aws_inst.tf

resource "aws_instance" "xenial" {
    ami = "${var.esya_ami}"
    instance_type = "t3.medium"
    ebs_optimized = true
    monitoring = true
    count = "8"
    key_name = "${var.aws_key_name}"
    tags{
        Name = "KubeVMCluster${count.index + 1}"
    }
}

aws_ami.tf

resource "aws_ami" "ami-ena" {
    name = "esya-ami-ena"
    virtualization_type = "hvm"
    ena_support = true
    root_device_name = "/dev/xvda"
}

ami detail in variables.tf:

variable "esya_ami" {
    description = "Ubuntu 16.04 LTS (Xenial Serus) AMI"
    #default = "ami-0653e888ec96eab9b"
    #default = "ami-04ea996e7a3e7ad6b"
    default = "ami-825e34ed"
}

I couldn't find a solution in Google searches. Is there a way to refer aws_ami in aws_instance or some other workaround?

Regards
Aditya

Regards
Aditya

question servicec2

Most helpful comment

Hi @ackris !

Based on AMI ID you specified I assume that you've been trying it in ap-south-1 region which does not have T3 types of instances available yet. (Source: https://aws.amazon.com/blogs/aws/new-t3-instances-burstable-cost-effective-performance/)

Also, if you want to filter AMIs by sriov-net-support you should add filter block to data-source like this (see this for the complete list of filters):

filter {
    name = "sriov-net-support"
    values = ["simple"]
}

If you change to any other region where T3 exists your code will work. I've just tried it.

All 6 comments

@jbardin @antonbabenko

Any solution? Others are also welcome to post their thoughts.

Today I have tried data aws_ami trick, but it didn't work.

aws_inst.tf:


data "aws_ami" "ubuntu" {
    most_recent = true

    filter {
        name = "name"
        values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"]
    }

    filter {
        name = "virtualization-type"
        values = ["hvm"]
    }

    owners = ["099720109477"]
    #sriov_net_support = true
    #architecture = "x86_64"
}

resource "aws_instance" "xenial" {
    ami = "${data.aws_ami.ubuntu.id}"
    instance_type = "t3.medium"
    ebs_optimized = true
    monitoring = true
    count = "8"
    key_name = "${var.aws_key_name}"
    tags{
        Name = "KubeVMCluster${count.index + 1}"
    }
}

The output of terraform apply is


* aws_instance.xenial.1: Error launching source instance: Unsupported: The requested configuration is currently not supported. Please check the documentation for supported configurations.
    status code: 400, request id: c710dc20-79b5-4bbd-8a36-6a767bd07437

If I apply sriov_net_support = true, I am told by terraform that it shouldn't be applied.

Please help.

Regards
Aditya

Hi @ackris !

Based on AMI ID you specified I assume that you've been trying it in ap-south-1 region which does not have T3 types of instances available yet. (Source: https://aws.amazon.com/blogs/aws/new-t3-instances-burstable-cost-effective-performance/)

Also, if you want to filter AMIs by sriov-net-support you should add filter block to data-source like this (see this for the complete list of filters):

filter {
    name = "sriov-net-support"
    values = ["simple"]
}

If you change to any other region where T3 exists your code will work. I've just tried it.

Hi @antonbabenko

Thanks mate! I switched to t2.medium instance with ebs_optimized = false. This part is working, but when I try to login to my instances using PuTTY and SSH, it is giving me timed-out error.

Note: I am very new to Terraform. Please bear with me :)

Regards
Aditya

Terraform part is probably done. Verify that your instance is launched in public subnet and you have opened SSH port on it.

Check AWS documentation about how to connect to EC2 instances - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html

Hi @ackris and @antonbabenko! :wave:

We use GitHub issues in this repository for tracking Terraform AWS provider bugs and enhancements rather than for questions. While we may be able to help with some simple problems here it's generally better to use one of the community forums where there are far more people ready to help; the GitHub issues here are generally monitored only by our few maintainers and a small subset of community members who are more generally only working on Terraform provider bugs or enhancements.

Since it does not appear there is an actionable bug/feature here (reporting EC2 instance configuration errors better would be impractical to maintain ourselves; I would recommend opening an AWS Support case for the EC2 API to return better messages), I am going to close this issue, but please feel free to continue any lingering conversation and good luck!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

Was this page helpful?
0 / 5 - 0 ratings