Amazon-ebssurrogate Process Is Creating root disk snapshot and AMI

Skip to first unread message

Ammad Khan

Oct 29, 2021, 9:39:41 AM10/29/21
to Packer

Since 2 years I'm using packer and it was perfectly working without a single for Debian 9(stretch). Recently, I changed the filters and tried to create a new AMI with amazon-ebssurrogate for buster but it was taking a snapshot and creating AMI of root(xvda) disk instead of EBS attached volume (xvdf).

I'm using the packer 1.6.2 amd64 version, for reference I'm sharing the JSON snippet.

      "type": "amazon-ebssurrogate",
      "access_key": "{{user `aws_access_key`}}",
      "secret_key": "{{user `aws_secret_key`}}",
      "region": "us-east-1",
      "ssh_username": "admin",
      "instance_type": "t3.small",
      "ami_name": "Cloudways-{{user `DISTRIBUTION`}}-{{user `ENV_TYPE`}}[{{isotime \"02/01/2006\"}}]",
      "ami_virtualization_type": "hvm",
      "ena_support" : true,
      "source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "name": "debian-10-amd64*",
          "root-device-type": "ebs",
          "architecture": "x86_64"
        "owners": ["136693071363"],
        "most_recent": true
      "tags": {
         "env": "{{user `ENV_TYPE`}}"
      "launch_block_device_mappings": [
          "volume_type": "gp2",
          "device_name": "/dev/xvdf",
          "delete_on_termination": false,
          "volume_size": 25,
          "snapshot_id": "{{user `SNAPSHOT_ID`}}"
      "ami_root_device": {
        "source_device_name": "/dev/xvdf",
        "device_name": "/dev/xvda",
        "delete_on_termination": false,
        "volume_size": 25,
        "volume_type": "gp2"
  "provisioners": [
      "type": "shell",
      "inline": [
        "sudo mkdir /mnt/disk",
        "sudo mount /dev/nvme1n1p1 /mnt/disk",
        "sudo touch /mnt/disk/etc/resolv.conf"
      "type": "shell",
      "execute_command": "sudo -S sh -c '{{ .Vars }} {{ .Path }}'",
      "script": "",
      "environment_vars": [
        "PROVIDER={{ user `PROVIDER` }}",
        "ENV_TYPE={{ user `ENV_TYPE` }}",
        "DISTRIBUTION={{ user `DISTRIBUTION` }}"

Reply all
Reply to author
0 new messages