AWS AMI Maintenance

55 views
Skip to first unread message

TF

unread,
Mar 22, 2018, 6:48:43 AM3/22/18
to Packer
Hi list,

I've been looking for a solution to a problem I'm currently experiencing and thought I'd ask the list for help.

I need to de-register a snapshot an delete an AMI every time I make a new version. For that I'm using the plugin Amazon AMI Management(0) which works really well. It tags an image and allows me to specify how many version of an AMI I want to keep, during the post processor phase.

The only limitation of this plugin is that it does not allow for multi-region.

My question is: Is someone managing AMI's in different regions via packer? My objective is to have all older images and snapshots deleted after a successful build, in all the regions that are set in my user variable.

Thank you for any help/pointers!

(0) - https://github.com/wata727/packer-post-processor-amazon-ami-management

Megan Marsh

unread,
Mar 22, 2018, 12:36:31 PM3/22/18
to packe...@googlegroups.com
As of last summer, the force_deregister flag should work across multiple regions. Take a look at https://www.packer.io/docs/builders/amazon-ebs.html#force_deregister for details.

Tiago Faria

unread,
Mar 23, 2018, 2:09:55 PM3/23/18
to packe...@googlegroups.com
Hi Megan,

Thank you for the information. force_deregister and force_delete_snapshot are a great combo. 

Guess the only thing missing to have a full management solution would be to have the AMI being deleted if one with the same tag, for example, already existed. Similar to the plugin I posted. 

If anyone is doing this across different regions I’d be happy to know how. 

Thanks!
T

On Thu, 22 Mar 2018 at 16:36, Megan Marsh <megan....@gmail.com> wrote:
As of last summer, the force_deregister flag should work across multiple regions. Take a look at https://www.packer.io/docs/builders/amazon-ebs.html#force_deregister for details.

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/M2Gxk_gtchc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAGPV1upxts%2BzEvU_OLwfkFsi-q0jNOukgpKprvHGSJuxV-%2B5gA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Rickard von Essen

unread,
Mar 24, 2018, 2:43:34 AM3/24/18
to packe...@googlegroups.com
IMHO when it comes to more advanced lifecycle management it's better done with a script (shell, python, etc). It's very easy to create a advanced python script using boto3 to manage you AMI's. And then hook it into you CD pipeline so it runs after creation/promotion of new AMI's.

On 22 March 2018 at 20:17, Tiago Faria <tiago.far...@gmail.com> wrote:
Hi Megan,

Thank you for the information. force_deregister and force_delete_snapshot are a great combo. 

Guess the only thing missing to have a full management solution would be to have the AMI being deleted if one with the same tag, for example, already existed. Similar to the plugin I posted. 

If anyone is doing this across different regions I’d be happy to know how. 

Thanks!
T
On Thu, 22 Mar 2018 at 16:36, Megan Marsh <megan....@gmail.com> wrote:
As of last summer, the force_deregister flag should work across multiple regions. Take a look at https://www.packer.io/docs/builders/amazon-ebs.html#force_deregister for details.

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/M2Gxk_gtchc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool+unsubscribe@googlegroups.com.

--
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 packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAF8FeX8K_0sEAZUaO-LT-hTMSMdO89k9YKYeirJPFpYm%2B_u7Og%40mail.gmail.com.

Megan Marsh

unread,
Mar 26, 2018, 12:42:40 PM3/26/18
to packe...@googlegroups.com
I agree with Rickard on this one; once you get into advanced lifecycle maintenance you're leaving the territory that Packer is really designed for, and I don't think the project would ever be able to support this as well as tools specifically designed for that purpose.

Message has been deleted

Megan Marsh

unread,
Mar 30, 2018, 2:15:58 PM3/30/18
to packe...@googlegroups.com
cool! I appreciate the recommendation :)

On Thu, Mar 29, 2018 at 5:01 AM, TF <tiago.far...@gmail.com> wrote:
Hi list,

Thank you for the feedback. As a follow up, one of the plugins that I believe does a wonderful job in AMI management, just got updated to support multi-regions:


You just specify the number of releases you want to keep and the regions for which to apply this, and, based on a tag, the plugin will delete and de-register. 

wata727, don't know if you're on the list, but, if you are, thank you! Great stuff!


On Monday, March 26, 2018 at 5:42:40 PM UTC+1, Megan Marsh wrote:
I agree with Rickard on this one; once you get into advanced lifecycle maintenance you're leaving the territory that Packer is really designed for, and I don't think the project would ever be able to support this as well as tools specifically designed for that purpose.
On Fri, Mar 23, 2018 at 11:43 PM, Rickard von Essen <rickard....@gmail.com> wrote:
IMHO when it comes to more advanced lifecycle management it's better done with a script (shell, python, etc). It's very easy to create a advanced python script using boto3 to manage you AMI's. And then hook it into you CD pipeline so it runs after creation/promotion of new AMI's.
On 22 March 2018 at 20:17, Tiago Faria <tiago.far...@gmail.com> wrote:
Hi Megan,

Thank you for the information. force_deregister and force_delete_snapshot are a great combo. 

Guess the only thing missing to have a full management solution would be to have the AMI being deleted if one with the same tag, for example, already existed. Similar to the plugin I posted. 

If anyone is doing this across different regions I’d be happy to know how. 

Thanks!
T
On Thu, 22 Mar 2018 at 16:36, Megan Marsh <megan....@gmail.com> wrote:
As of last summer, the force_deregister flag should work across multiple regions. Take a look at https://www.packer.io/docs/builders/amazon-ebs.html#force_deregister for details.

--
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 a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/M2Gxk_gtchc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.

--
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 packer-tool...@googlegroups.com.

--
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 packer-tool...@googlegroups.com.

--
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 packer-tool+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages