Packer: Packer AWS builder ( amazon-ebs ) ami_block_device_mappings doesn't respect volume_type

Created on 24 May 2017  ยท  4Comments  ยท  Source: hashicorp/packer

  • Packer version from 0.12.3
  • Platform AWS/Redhat Linux

I am trying to bake an AWS AMI using amazon-ebs builder. In the template, I have below inside the builders to have a root volume of 20GB, when an EC2 is launched using the AMI.

"ami_block_device_mappings": [
  {
    "device_name": "/dev/sda1",
    "delete_on_termination": "true",
    "volume_size": 20,
    "volume_type": "standard"
   }
] 

The packer build goes fine and ami gets created. However when I launch an EC2 using that AMI, I notice that the root volume attached to the instance is of type gp2, even though the type is mentioned as standard in the template.

I have tried to do the packer build in debug mode, but it does not display much information about the volume.

Any pointers is much appreciated.

buildeamazon need-more-info waiting-reply

Most helpful comment

@prithulagta The problem is that you get similar to below snapshot mapping in AMI metadata when you use /dev/sda1 as device name:

Block Devices:
/dev/xvda=snap-097cab9b0d08a9575:8:true:gp2, /dev/sda1=:20:true:standard

Try to use /dev/xvda as device name and it should work fine:

Block Devices:
/dev/xvda=snap-0f559c7607c2b5e9f:20:true:standard

This doc http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
can be useful.

PS: This is not a packer problem but rather the way how Amazon handles your request.

All 4 comments

Please supply the information requested in the issue template:

  • Packer version (packer version)
  • Host platform (uname -a etc.)
  • Debug log output from PACKER_LOG=1 packer build template.json.
    Please paste this in a gist.
  • The _simplest example template and scripts_ needed to reproduce the bug.
    Include these in your gist.

@prithulagta The problem is that you get similar to below snapshot mapping in AMI metadata when you use /dev/sda1 as device name:

Block Devices:
/dev/xvda=snap-097cab9b0d08a9575:8:true:gp2, /dev/sda1=:20:true:standard

Try to use /dev/xvda as device name and it should work fine:

Block Devices:
/dev/xvda=snap-0f559c7607c2b5e9f:20:true:standard

This doc http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
can be useful.

PS: This is not a packer problem but rather the way how Amazon handles your request.

I think @Constantin007 has the solution. If this doesn't help, please open a new issue with the required debugging information.

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shantanugadgil picture shantanugadgil  ยท  3Comments

mushon4 picture mushon4  ยท  3Comments

jesse-c picture jesse-c  ยท  3Comments

craigsimon picture craigsimon  ยท  3Comments

mwhooker picture mwhooker  ยท  3Comments