Script to delete the nightly AMIs periodically #6613

Merged
jnsamyak merged 3 commits from clean-amis into master 2026-06-08 03:12:42 +00:00
Contributor

The nightly AMIs right now gets accumulated over time and needs to be deleted manually. This script will run as cron and:

  • remove the launch permissions of the AMIs after 5 days.
  • after the next 5 days, the AMIs whose launch permission where removed will be deleted.

This script needs to tested before actually deployment. The script has a --dry-run option which just prints the ami_id which would have been effected by that operation.

The nightly AMIs right now gets accumulated over time and needs to be deleted manually. This script will run as cron and: - remove the launch permissions of the AMIs after 5 days. - after the next 5 days, the AMIs whose launch permission where removed will be deleted. This script needs to tested before actually deployment. The script has a `--dry-run` option which just prints the ami_id which would have been effected by that operation.
Member

10 days in the state of "no launch permission" would be more desirable to me

10 days in the state of "no launch permission" would be more desirable to me
Contributor

@sayanchowdhury told me he's working on this PR this week, now that he's back from PyCon Pune.

@sayanchowdhury told me he's working on this PR this week, now that he's back from PyCon Pune.
Contributor

how is this supposed to be integrated into our processes?

how is this supposed to be integrated into our processes?
Author
Contributor

rebased

rebased
Author
Contributor

I've updated the script as @dustymabe pointed out.

This script will keep running separately as a cron. One thing that I will be adding after a few successful run of this script is that after the final release, the script is needed to be run to delete the pre-released (Alpha, Beta) AMIs.

I've updated the script as @dustymabe pointed out. This script will keep running separately as a cron. One thing that I will be adding after a few successful run of this script is that after the final release, the script is needed to be run to delete the pre-released (Alpha, Beta) AMIs.
Author
Contributor

Any update on this ticket? It's been a long time we have done the cleanup of the AMIs and there should have been a huge backlog of snapshots.

Any update on this ticket? It's been a long time we have done the cleanup of the AMIs and there should have been a huge backlog of snapshots.
Contributor

This really needs to get reviewed and merged. It's been many months, and in the meantime our EC2 EBS costs (snapshot image storage) have been mounting up, almost doubling in that time frame. This potentially puts the generous donation from our friends at Amazon at risk. Could someone in @releng resolve this please?

This really needs to get reviewed and merged. It's been many months, and in the meantime our EC2 EBS costs (snapshot image storage) have been mounting up, almost doubling in that time frame. This potentially puts the generous donation from our friends at Amazon at risk. Could someone in @releng resolve this please?
Contributor

Some of us spoke on IRC and came up with a plan, for now @puiterwijk will provision us limited AWS tokens in order to run this with cron on compose-x86-01 and then we'll move to loopabull once that's available.

Merging.

Some of us spoke on IRC and came up with a plan, for now @puiterwijk will provision us limited AWS tokens in order to run this with cron on compose-x86-01 and then we'll move to loopabull once that's available. Merging.
Contributor

Pull-Request has been merged by maxamillion

Pull-Request has been merged by maxamillion
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
releng/tickets!6613
No description provided.