Delete EBS volume after packer finishes build

1,024 views
Skip to first unread message

Rahul Mehrotra

unread,
Aug 20, 2014, 11:13:24 PM8/20/14
to packe...@googlegroups.com
Hi,
I am beginner using packer. I have written packer to create AMI for use. However  have seen that packer does not delete the attached volume after it finishes the build process. As a result I have large volumes left . I wish to know if there is any way I can tell packer to clean up after the build process. Thanks 

Alvaro Miranda Aguilera

unread,
Aug 20, 2014, 11:50:37 PM8/20/14
to packe...@googlegroups.com
Is this anything that answer your question ? :


http://www.packer.io/intro/getting-started/build-image.html

Managing the Image

Packer only builds images. It does not attempt to manage them in any way. After they're built, it is up to you to launch or destroy them as you see fit. As a result of this, after running the above example, your AWS account now has an AMI associated with it.

AMIs are stored in S3 by Amazon, so unless you want to be charged about $0.01 per month, you'll probably want to remove it. Remove the AMI by first deregistering it on the AWS AMI management page. Next, delete the associated snapshot on the AWS snapshot management page.





On Thu, Aug 21, 2014 at 3:13 PM, Rahul Mehrotra <rhlm...@gmail.com> wrote:
Hi,
I am beginner using packer. I have written packer to create AMI for use. However  have seen that packer does not delete the attached volume after it finishes the build process. As a result I have large volumes left . I wish to know if there is any way I can tell packer to clean up after the build process. Thanks 

--
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 packer-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rahul Mehrotra

unread,
Aug 21, 2014, 12:04:56 AM8/21/14
to packe...@googlegroups.com
Hi Alvaro,
Thanks for your reply. My concern is with the volume and not the snapshot. After Packer completes, the detached volume is still available in volumes tab and snapshot is present in snapshot tab.

dcap...@pivotal.io

unread,
Dec 31, 2014, 1:55:38 PM12/31/14
to packe...@googlegroups.com
I am facing this issue as well. The AMI that gets generated by packer will cleanup after its self, but the AMI that packer users for creating the new AMI doesn't get the volume cleaned up. It would be great if there was a flag in packer to have the instance volume cleaned up.

# packer version
Packer v0.7.5

Nicolas G

unread,
Feb 10, 2015, 11:45:08 AM2/10/15
to packe...@googlegroups.com
What we really want here is not for packer to manage and destroy any leftovers EBS volumes but actually when creating a new AMI to have the option build "Delete on Termination" .

my +1 to have this feature implemented.

Prasanna Santhanam

unread,
Feb 10, 2015, 11:35:40 PM2/10/15
to packe...@googlegroups.com
You can specify delete_on_termination in the packer recipe through
launch_block_device_mappings. Is this what you were looking for?

"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 16,
"delete_on_termination": true
}
]
Reply all
Reply to author
Forward
0 new messages