Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ami-housekeeper] allow customizing ParameterFilters for SSM #4259

Open
GMartinez-Sisti opened this issue Nov 13, 2024 · 0 comments
Open

[ami-housekeeper] allow customizing ParameterFilters for SSM #4259

GMartinez-Sisti opened this issue Nov 13, 2024 · 0 comments

Comments

@GMartinez-Sisti
Copy link

GMartinez-Sisti commented Nov 13, 2024

Hi, I've been using ami-housekeeper for some time now, it really helps to make sure we don't end up with a lot of AMIs as I build a new one every week.

Although, today I had an issue where AMIs in use were deleted and I was able to pinpoint it to the ami-housekeeper SSM query that didn't match up our provided ssmParameterNames filter. After investigating and reading the docs again I realized that the ami-housekeeper expects the parameters to contain ami-id in the name. Initially I thought this was a suggestion, instead of a requirement since we can also customize the filter to search for parameter name using ssmParameterNames. Docs:

When you set ssmParameterNames to *ami-id, the module will regard all AMIs referenced in SSM as in use, sparing them from deletion.

I looked into the code to check how to customize it:

new DescribeParametersCommand({
ParameterFilters: [
{
Key: 'Name',
Values: ['ami-id'],
Option: 'Contains',
},
],
}),

and would like to add a new parameter named ssmParameterFilters to use the defaults as the current values, but allow it to be customizable so we can use any desired filter. I already have a working lambda, so please let me know if this is something that would be accepted and I would open a PR for it.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant