I made these two:
aws_ecs_list_services(){
cluster=${1:-xxxx}
taskarn=$(aws ecs list-services --cluster $cluster | grep "arn" | tr -d '"'| cut -d':' -f6 | cut -d'/' -f3 | tr -d ',')
echo $taskarn;
}
aws_describe_services(){
cluster=${1:-xxx}
aws_ecs_list_services $cluster | xargs -n 1 -t aws ecs describe-services --cluster $cluster --query 'services[*].events[0]' --output table --services
}
bash function to query the services in my AWS cluster and check the status of the services.
I get a nice glance of what is going on,
problem is that the event date is in EPOCH time (for example: 1668770177.526
)
I can manually convert it
using this other function:
convert_timestamp_to_date(){
time_stamp_to_date=$(date -r $1)
echo $time_stamp_to_date
export tim
}
but I first have to multiply for 1000 and then run
convert_timestamp_to_date 1668770177526
Wonder if there is a way of refactoring the aws api call to have the event formatted as human readable.