Last active
November 28, 2023 17:34
-
-
Save jonprindiville/a12744c26027fcb88e8a96ea9844e257 to your computer and use it in GitHub Desktop.
Tell me about ECS startup timing...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -euo pipefail | |
CLUSTER="${1}" | |
TASKS="${2}" | |
aws ecs describe-tasks --cluster "${CLUSTER}" --tasks "${TASKS}" \ | |
| jq '.tasks[] | |
| { | |
meta: { | |
clusterArn: .clusterArn, | |
connectivity: .connectivity, | |
desiredStatus: .desiredStatus, | |
healthStatus: .healthStatus, | |
lastStatus: .lastStatus, | |
taskDefinitionArn: .taskDefinitionArn | |
}, | |
timing: { | |
createdAt: .createdAt|match("[-:0-9T]+").string|strptime("%Y-%m-%dT%H:%M:%S")|mktime, | |
connectivityAt: .connectivityAt|match("[-:0-9T]+").string|strptime("%Y-%m-%dT%H:%M:%S")|mktime, | |
pullStartedAt: .pullStartedAt|match("[-:0-9T]+").string|strptime("%Y-%m-%dT%H:%M:%S")|mktime, | |
pullStoppedAt: .pullStoppedAt|match("[-:0-9T]+").string|strptime("%Y-%m-%dT%H:%M:%S")|mktime, | |
startedAt: .startedAt|match("[-:0-9T]+").string|strptime("%Y-%m-%dT%H:%M:%S")|mktime | |
} | |
} as $result | |
| { | |
deltas: { | |
createdToConnectivity: ($result.timing.connectivityAt - $result.timing.createdAt), | |
connectivityToPullStarted: ($result.timing.pullStartedAt - $result.timing.connectivityAt), | |
pullStartedToPullStopped: ($result.timing.pullStoppedAt - $result.timing.pullStartedAt), | |
pullStoppedToStarted: ($result.timing.startedAt - $result.timing.pullStoppedAt), | |
createdToStarted: ($result.timing.startedAt - $result.timing.createdAt) | |
} | |
} as $deltaResult | |
| {meta: $result.meta, timing: $result.timing, deltas: $deltaResult.deltas}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment