UnsupportedOperation: The instance configuration for this AWS Marketplace product is not supported

My use case is pretty straight-forward. I’d like to use HashiCorp Packer to build an AMI using the official and public NGINX Plus Standard RHEL8 image (ami-082468b3de1f58557 in eu-central-1 region) from the AWS Marketplace as a base/source image, and apply some custom configurations onto it, ideally with Ansible.

I got the pkr.hcl working insofar that it fails with a 400 status code while outputting an AWS error message as follows:

amazon-ebs.quick-start: output will be in this color.

==> amazon-ebs.quick-start: Prevalidating any provided VPC information
==> amazon-ebs.quick-start: Prevalidating AMI Name: packer-example 20220726114416
    amazon-ebs.quick-start: Found Image ID: ami-082468b3de1f58557
==> amazon-ebs.quick-start: Creating temporary keypair: packer_62dfd390-df67-b48e-cfef-bddd1d6b9da1
==> amazon-ebs.quick-start: Creating temporary security group for this instance: packer_62dfd391-9a00-a7bb-429c-6b0ea6f52ec3
==> amazon-ebs.quick-start: Authorizing access to port 22 from [0.0.0.0/0] in the temporary security groups...
==> amazon-ebs.quick-start: Launching a source AWS instance...
==> amazon-ebs.quick-start: Error launching source instance: UnsupportedOperation: The instance configuration for this AWS Marketplace product is not supported. Please see the AWS Marketplace site for more information about supported instance types, regions, and operating systems.
==> amazon-ebs.quick-start:     status code: 400, request id: 539ae23b-a080-4656-8ea2-84de6466c208
==> amazon-ebs.quick-start: No volumes to clean up, skipping
==> amazon-ebs.quick-start: Deleting temporary security group...
==> amazon-ebs.quick-start: Deleting temporary keypair...
Build 'amazon-ebs.quick-start' errored after 2 seconds 951 milliseconds: Error launching source instance: UnsupportedOperation: The instance configuration for this AWS Marketplace product is not supported. Please see the AWS Marketplace site for more information about supported instance types, regions, and operating systems.
        status code: 400, request id: 539ae23b-a080-4656-8ea2-84de6466c208

==> Wait completed after 2 seconds 951 milliseconds

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs.quick-start: Error launching source instance: UnsupportedOperation: The instance configuration for this AWS Marketplace product is not supported. Please see the AWS Marketplace site for more information about supported instance types, regions, and operating systems

My pkr.hcl is mostly copied over from the quickstart example snippet on the hashicorp/packer Github page, having adjusted the source_ami field inside source.

variable "access_key" {
  type    = string
  default = "${env("AWS_ACCESS_KEY_ID")}"
}

variable "secret_key" {
  type      = string
  default   = "${env("AWS_SECRET_ACCESS_KEY")}"
  sensitive = true
}

variable "session_token" {
  type      = string
  default   = "${env("AWS_SESSION_TOKEN")}"
  sensitive = true
}

locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }

source "amazon-ebs" "quick-start" {
  access_key    = "${var.access_key}"
  ami_name      = "packer-example ${local.timestamp}"
  instance_type = "t2.micro"
  region        = "eu-central-1"
  secret_key    = "${var.secret_key}"
  token         = "${var.session_token}"
  source_ami    = "ami-082468b3de1f58557"
  skip_region_validation = "true"
  ssh_username  = "admin"
}

build {
  sources = ["source.amazon-ebs.quick-start"]
}

I checked the respective ami-082468b3de1f58557 image inside the AWS console, and it seems to not support any arm64 based instance types. To be honest, I’m a bit confused as my host system, onto which I launched packer build mybuild.pkr.hcl is x86_64 based arch. Also, I’m unable to see what Packer is actually trying to attempt to do.

Is it possible to make the output, i.e. the error messages more verbose with perhaps a --debug flag (which I indeed unsuccessfully tried to do so). Furthermore, what may the actual root cause be?

Looking forward to hear some insights from y’all and thanks in advance. :slight_smile: