[ECS] [request]: Task Definition Life Cycle Management
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
***Request for comment: Please share your thoughts on this proposed improvement to Amazon ECS.***
ECS will deliver a smarter/automated mechanism for task definition lifecycle management. Customers will be able to configure task definition revision lifecycle policies at an account level to automatically deregister and delete task definition revisions that are no longer in use. With this feature, you would be able to configure how long to retain task definition revisions with an active or inactive state that are not associated with any running task or service before they are either deregistered or deleted. If you have not opted into configuring a retention period based on time in days since last used for an active task definition revision, you can configure how many active past revisions per task definition family you would like to retain before those task definition revisions are deregistered.
Proposed API spec for the lifecycle policy is:
{
"PutTaskDefinitionLifeCyclePolicy": {
"ActiveTaskDefinitionRetentionPeriod": integer,
"InactiveTaskDefinitionRetentionPeriod": integer,
"MaximumRevisionsPerTaskDefinitionFamily": integer
}
}
Parameter | Definition
-- | --
ActiveTaskDefinitionRetentionPeriod | This attribute is defined in terms of days and sets the maximum for how many days a task definition revision with an active state that are not associated with any running task or service should be retained before they are deregistered. This attribute is compared to the days since the task definition revision was last used by a service or task. This attribute can only be configured if MaximumRevisionsPerTaskDefinitionFamily is not configured.This attribute is specified in terms of days and can be specified as a value from 0 through 365 (where zero means forever).
InactiveTaskDefinitionRetentionPeriod | This attribute is defined in terms of days and sets the maximum for how long task definition revisions with an inactive state (already deregistered) that are not associated with any running task or service should be retained before they are deleted. This attribute is compared to the days since the task definition revision was deregistered. This attribute is specified in terms of days and can be specified as a value from 0 through 365 (where zero means forever).
MaximumRevisionsPerTaskDefinitionFamily | This attribute sets the maximum number of active task definition revisions that should be retained before they are deregistered. The oldest revisions based on last used date will be deregistered. This attribute can only be configured if ActiveTaskDefinitionRetentionPeriod is not configured. This attribute is specified in terms of the number of task definition revisions and can be specified as a value from 0 through N (where zero means unlimited).
For example:
Case 1:
- If you used a value of 180 for
ActiveTaskDefinitionRetentionPeriod, ECS will deregister any active task definition revision that are not associated with any running tasks or services and have not been used for 180 days. - If you used a value of 180 for
InactiveTaskDefinitionRetentionPeriod, ECS will delete any inactive task definition revision that are not associated with any running tasks or services and have been deregistered more than 180 days ago
ActiveTaskDefinitionRetentionPeriod and MaximumRevisionsPerTaskDefinitionFamily are mutually exclusive and thus you can only configure one at any given point- If you used a value of 10 for
MaximumRevisionsPerTaskDefinitionFamily, ECS will only retain the 10 latest active revisions in a task definition family and will deregister any others that are not associated with any running task or service.
**Which service(s) is this request for?**
ECS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
I need a scalable way to manage my task definition resources.
**Are you currently working around this issue?**
Task Definitions can be managed (registered, deregistered, and deleted) using ECS Console or via API.
**Additional context**
https://github.com/aws/containers-roadmap/issues/685
**Attachments**
N/A
Contributor guide
Assessment
This issue has not been assessed yet.