Example:
"launch_block_device_mappings": [
{
"device_name": "/dev/sdb",
"volume_type": "gp2",
"snapshot_id": "snap-XXXX",
"delete_on_termination": true
}
],
"ami_block_device_mappings": [
{
"device_name": "/dev/sdb",
"no_device": true
}
]
The launch bdm will create a volume from you snapshot that will be
available on your instance (you might have to mount it).
The AMI bdm takes the same device and sets no_device which excludes it from
the AMI.
On Wed, Dec 5, 2018 at 10:21 PM Neil Natarajan <[email protected]> wrote:
> Alvaro - It is just one snapshot that has some scripts. It was manually
> created once. I need to use these scripts to install packages so I bake a
> new EBS backed AMI.
>
> Rickard - Could you explain the usage of launch_block_device_mappings and
> ami_block_device_mappings? I am confused as to how I would be using both in
> order to avoid the snapshot containing the Scripts getting added to the
> AMI.
>
> On Wed, Dec 5, 2018 at 1:09 PM Rickard von Essen <
> [email protected]> wrote:
>
>> You should use Packer for this. amazon-ebs should be enough for this. If
>> you are new to packer I suggest you start with that and ignore your extra
>> volume first until you get a hang of it. Then it's just adding it to the
>> launch_block_device_mappings and drop it in the ami_block_device_mappings
>> so it isn't added to the AMI.
>>
>> On Wed, Dec 5, 2018, 20:17 <[email protected] wrote:
>>
>>> I have a source AMI and I want to bake a new AMI with some additional
>>> packages. I have a snapshot with scripts to install these packages. I was
>>> wondering what combination of builders/provisioners/etc I would use to
>>> create a volume from this snapshot and then install packages to a different
>>> volume (root volume). I would then need to unmount the additional volume
>>> created from the snapshot so it is not baked into the AMI as well.
>>>
>>> My guess was to use an ' amazon-ebsvolume ' builder to create a volume
>>> from the snapshot, then use ' amazon-ebs ' builder to actually create the
>>> AMI. I am slightly confused, however, on how I would order the events so
>>> the AMI created would only have the root volume baked in. I was looking at
>>> using ' launch_block_device_mappings '.
>>>
>>> Is this easily done in packer? In terraform, I can see how to create a
>>> volume from a snapshot easily and with packer I see how to create an AMI
>>> given a source AMI. Is there a way to do both cleanly in packer?
>>>
>>> --
>>> This mailing list is governed under the HashiCorp Community Guidelines -
>>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>>> violation of those guidelines may result in your removal from this mailing
>>> list.
>>>
>>> GitHub Issues: https://github.com/mitchellh/packer/issues
>>> IRC: #packer-tool on Freenode
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Packer" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/packer-tool/76673db5-2111-4159-b948-f78aa7d06bce%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/76673db5-2111-4159-b948-f78aa7d06bce%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> This mailing list is governed under the HashiCorp Community Guidelines -
>> https://www.hashicorp.com/community-guidelines.html. Behavior in
>> violation of those guidelines may result in your removal from this mailing
>> list.
>>
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/packer-tool/CALz9Rt9TwxLWCkiziGy2-smESHDKO_C%3D1Fn2ApScMj2SRR7-4A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/packer-tool/CALz9Rt9TwxLWCkiziGy2-smESHDKO_C%3D1Fn2ApScMj2SRR7-4A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/CAG1V0QhxxwKDEn9MZsCt0EzvCKFHNfuuQZKLgn08oj%3DVEOtQLA%40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CAG1V0QhxxwKDEn9MZsCt0EzvCKFHNfuuQZKLgn08oj%3DVEOtQLA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-oC6EDPwDYR4wBCxaGqsa24uKw9D5kivf2zyf8hEmsgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.