Failure: packer ebssurrogate builder - custom ubuntu ami - instance doesnt boot up

  • Custom image is written to the EBS volume in provision step.
  • I checked in debug mode, it looks like EBS volume not set properly for boot. I can’t tell what step is missing in my packer config.
  • EBS backed AMI gets generated, when instance is launched OS never boots up.

Any suggestion/input is really appreciated. For my usecase is this the right approach?

packer config:

``source “amazon-ebssurrogate” “baseimage-ami” {
profile = “dev”
ami_name = “baseimage-0.0.1-unreleased”
ami_regions = [“us-east-1”]
aws_polling {
delay_seconds = 60
max_attempts = 60
}
ami_root_device {
source_device_name = “/dev/sdb”
device_name = “/dev/xvda”
volume_size = “{var.volume_size}" volume_type = "gp2" delete_on_termination = true } ami_block_device_mappings { device_name = "/dev/xvdb" volume_size = "1" volume_type = "gp2" delete_on_termination = true } ami_virtualization_type = "hvm" launch_block_device_mappings { delete_on_termination = true device_name = "/dev/sdb" volume_size = "{var.volume_size}”
volume_type = “gp2”
}
ena_support = true
instance_type = “t2.micro”
region = “us-east-1”
source_ami = “ami-2d39803a”
ssh_username = “ubuntu”
}

build {
sources = [“source.amazon-ebssurrogate.baseimage-ami”]

provisioner “file” {
destination = “/tmp/image”
source = “file.img.gz”
}

provisioner “file” {
destination = “/tmp/”
source = “burnImage.sh”
}

provisioner “shell” {
inline = [“sudo zcat /tmp/image > /dev/xvdb”,
“sync”
]
}`