Can someone point me where fast_launch_template_config should be?

Hi,
I am trying to build ami with fast_lunch.

source “amazon-ebs” “ami” {

fast_launch {
enable_fast_launch=true
fast_launch_template_config {
region = “${var.region}”
}
}

}
If i define it like this it is throwing
Blocks of type “fast_launch_template_config” are not expected here

If you copy the AMI to other regions use instead the fast_launch_template_config option.
so i need to use it
fast_launch {
enable_fast_launch=true
}
Like this configuration is valid but i need to copy it to another region so i need to have fast_laubch_template_config

I couldn’t find any example how to define it.
BR,
tahchiev

Hi @tahchiev,

It looks like the plugin is being misleading here, sorry about that.

The block you’re looking for is actually named region_launch_templates, FastLaunchTemplateConfig is the structure’s name in the code, and the name you’re seeing is a relic from the WIP code, that should be changed. I’ll see to that ASAP.

Reagrding the accepted configuration for this block, I would suggest taking a look at the plugin docs for more accurate information. This is generated from the code, so it best reflects what is accepted by the plugin in this case.

If you need examples, I’d be surprised if you found any on the net since the option is recent (we released that as part of our latest AWS plugin release 2 weeks ago), but you can find such an example in our acceptance tests should you need it.

Hope that helps!

Thanks,
inside the docs is written if we don’t specify it it will use default but i am getting strange result.
i used only

source “amazon-ebs” “ami” {
fast_launch {
enable_fast_launch=true

}
}
According to the logs it is enalbed
==> shrdsvcs-JNK.amazon-ebs.ami: Enabling fast boot for AMI ami-05c60332f2d329517 in region us-east-2
==> shrdsvcs-JNK.amazon-ebs.ami: Enabling fast boot for AMI ami-09df4dab8093db255 in region us-east-1

==> shrdsvcs-JNK.amazon-ebs.ami: Error enabling fast boot for AMI in region us-east-1: retry count exhausted. Last err: InvalidRequest: Can’t enable EC2 Fast Launch. Run instances dry run failed for enabling EC2 Fast Launch. No default VPC for this user. GroupName is only supported for EC2-Classic and default VPC. To enable EC2 Fast Launch, you must use a launch template that specifies a subnet ID or network interface ID.
==> shrdsvcs-JNK.amazon-ebs.ami: status code: 400, request id: c2a8cae4-26c4-4c35-a11a-2778a20a173e
==> shrdsvcs-JNK.amazon-ebs.ami: Error enabling fast boot for AMI in region us-east-2: retry count exhausted. Last err: InvalidRequest: Can’t enable EC2 Fast Launch. Run instances dry run failed for enabling EC2 Fast Launch. No default VPC for this user. GroupName is only supported for EC2-Classic and default VPC. To enable EC2 Fast Launch, you must use a launch template that specifies a subnet ID or network interface ID.
==> shrdsvcs-JNK.amazon-ebs.ami: status code: 400, request id: 14bcb497-9fde-4f48-a342-dfb8d8c07a05

Any idea what i am doing wrong.?I guess i need to use template with subnet id and network interface , it will not work with defaults.
BR,
tahchiev

Yeah that’s an AWS error, when enabling fast-launch without specifying a launch template, AWS will generate one if your configuration allows it, but in your case it seems it doesn’t since you don’t have a default VPC.

Please refer to the AWS docs on that subject for more information: Configure Windows fast launch settings for your Amazon EC2 Windows Server AMI - Amazon Elastic Compute Cloud

1 Like

Just for the rest having issues with this…here is working example

fast_launch {
    enable_fast_launch    = true
    target_resource_count = 1

    region_launch_templates {
      region = "us-east-1"
      template_id="***"
    }
   region_launch_templates {
      region = "us-east-2"
      template_id="***"
    }
}