[ECS] [request]: Improve 'ListTaskDefinitions' API call
- 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**
I would like to request improving the [ListTaskDefinitions API Call](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListTaskDefinitions.html), in order to display Task Definition creation date.
**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?**
Even though the [DescribeTaskDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListTaskDefinitions.html) will provide all the information regarding the Task Definition (including the creation date), it would be nice to include at least some metadata or basic information about the Task definition (like the creation date) in the **ListTaskDefinitions** API call. As per how currently works, it forces to issue a new API call or chain commands just to get the basic details.
Other option would be allowing the **--sort** flag to also consider creation dates while sorting. This may be easier to implement and will greatly expand the options for this call. Most of the times and in many use cases we will be interested only in recently modified Tasks.
Other option would be improving the [DescribeTaskDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DescribeTaskDefinition.html) API Call (maybe DescribeTaskDefinitions?) in order to request details from multiple Task Definitions at the same time.
As per the current options, working with Task Definitions and metadata is tedious and requires custom iterations and command chaining.
**Are you currently working around this issue?**
Custom scripts and chaining commands for getting all the metadata from the Tasks. A sample snippet:
```
task_defs_arns=$(aws ecs list-task-definitions --status $STATUS --family-prefix $FAMILY_NAME --sort $SORT --query 'taskDefinitionArns' --output text)
for taskdef in $task_defs_arns;
do
aws ecs describe-task-definition \
--task-definition $taskdef \
--query "taskDefinition | [taskDefinitionArn,registeredAt,registeredBy]" \
--output text
done
```
**Additional context**
N / A
**Attachments**
N / A
Contributor guide
Assessment
This issue has not been assessed yet.