agent/containermetadata/utils.go
func getTaskIDfromARN(taskARN string) (string, error) {
	colonSplitARN := strings.SplitN(taskARN, ":", 6)
	// Incorrectly formatted ARN (Should not happen)
	if len(colonSplitARN) < 6 {
		return "", fmt.Errorf("get task ARN: invalid TaskARN %s", taskARN)
	}
	arnTaskPartSplit := strings.SplitN(colonSplitARN[5], "/", 2)
	// Incorrectly formatted ARN (Should not happen)
	if len(arnTaskPartSplit) < 2 {
		return "", fmt.Errorf("get task ARN: cannot find TaskID for TaskARN %s", taskARN)
	}
	return arnTaskPartSplit[1], nil
}
func getTaskIDfromARN(taskARN string) (string, error) {
	colonSplitARN := strings.SplitN(taskARN, ":", 6)
	// Incorrectly formatted ARN (Should not happen)
	if len(colonSplitARN) < 6 {
		return "", fmt.Errorf("get task ARN: invalid TaskARN %s", taskARN)
	}
	arnTaskPartSplit := strings.SplitN(colonSplitARN[5], "/", 2)
	// Incorrectly formatted ARN (Should not happen)
	if len(arnTaskPartSplit) < 2 {
		return "", fmt.Errorf("get task ARN: cannot find TaskID for TaskARN %s", taskARN)
	}
	return arnTaskPartSplit[1], nil
}
// getTaskIDfromARN parses a task ARN and produces the task ID
// A task ARN has format arn:aws:ecs:[region]:[account-id]:task/[task-id]
// For a correctly formatted ARN we split it over ":" into 6 parts, the last part
// containing the task-id which we extract by splitting it by "/".
// This function should be eventually be replaced by a standardized ARN parsing
// module