Эта страница переведена автоматически. Читать английский оригинал.

Recipe

task-ecs

The generic ephemeral compute primitive as an Amazon ECS task on Fargate that an EventBridge Scheduler schedule starts, rendered by vendoring a Terraform module kept beside this Recipe. Reach for it where the target is an AWS account with an ECS cluster and a VPC; reach for helm/task on Kubernetes, which also runs a task with no schedule once. A task with no schedule carrying core/manual-trigger is deployed without starting, its task definition alone; the operator starts each run with aws ecs run-task, giving the cluster, the task definition and the network configuration from infra.overrides. A scheduled task runs on its schedule, attached or not, and can be started that way too. Any other unscheduled task is refused by name, as nothing on AWS starts it. The cron fields become the scheduler's own expression where the two mean the same times, evaluated in UTC unless the Release names a time zone, and are refused by name where they do not, as for a schedule restricting both the day of the month and the day of the week. The cluster, subnets, security groups, execution role and, with a schedule, the scheduler's role come from infra.overrides and are required. Only a task definition and a schedule are emitted: no role, log group or network resource, each of which the operator already runs, and no service, as a run ends. Each env entry an edge or the component's own inject block dictates becomes a container variable; timeout arrives by default as TASK_TIMEOUT, which no edge may dictate while it is the default, for the code to honour, as ECS sets no deadline on a run. File, arg and other entries are refused by name. The task runs at the smallest Fargate size meeting infra.compute.

Версия

1.0.01.0.1

Происхождение

ОфициальныйПодписано идентичностью подписи, которую этот каталог признаёт официальным издателем.
Дайджест содержимого
sha256:924a581722599fe026b7b6fc3afa1e946c21ce2771444207ea997c1079cdf4e5
Опубликовано
2026-11-15T08:09:51Z
Идентичность подписи
https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main

Подпись

  • Официальныйapplication/vnd.dev.sigstore.bundle.v0.3+json

    https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main

    sha256:137d68b1904a5b2f5cb98e069fb76f6daf1ffa995c69516675136dd7a08eb549

Ссылка на эту версию

oci://hub.aggrega.ai/recipe/terraform/task-ecs:1.0.1
Цель
—
Реализует
core/compute/task:1.0.1

Предоставляет

Детерминированные шаблоны указателей, которые этот рецепт связывает для потребителей.

Шаблоны provides не объявлены.

Workload

Шаблон рабочей нагрузки не объявлен.

Локальные значения

ИмяШаблон
instance_id{{ .context.instance_id }}
schedule_translation{{- $s := trim (toString (optional .values "schedule" "")) -}} {{- $out := "" -}} {{- if $s -}} {{- $f := regexSplit `\s+` $s -1 -}} {{- $descriptors := dict "@yearly" "0 0 1 1 *" "@annually" "0 0 1 1 *" "@monthly" "0 0 1 * *" "@weekly" "0 0 * * 0" "@daily" "0 0 * * *" "@midnight" "0 0 * * *" "@hourly" "0 * * * *" -}} {{- if and (eq (len $f) 1) (hasKey $descriptors (index $f 0)) -}} {{- $f = regexSplit `\s+` (index $descriptors (index $f 0)) -1 -}} {{- end -}} {{- if hasPrefix "@every" $s -}} {{- $out = "refuse:@every repeats at an interval counted from a moment Kubernetes chooses, which an EventBridge Scheduler schedule cannot reproduce: write the schedule as five cron fields" -}} {{- else if regexMatch `^(CRON_)?TZ=` (index $f 0) -}} {{- $out = "refuse:it names a time zone inside the expression, where an EventBridge Scheduler expression takes none: write the five fields alone, and name the time zone under infra.overrides in the Release" -}} {{- else if ne (len $f) 5 -}} {{- $out = printf "refuse:it has %d fields where a cron expression has five, minute, hour, day of the month, month and day of the week: write the schedule as those five fields" (len $f) -}} {{- else -}} {{- $item := `^(\*|\?|[0-9]+(-[0-9]+)?)(/[0-9]+)? task-ecs 1.0.1 · Каталог Aggrega -}} {{- $min := index $f 0 -}}{{- $hour := index $f 1 -}}{{- $dom := index $f 2 -}} {{- $mon := lower (index $f 3) -}}{{- $dow := lower (index $f 4) -}} {{- range $i, $n := list "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec" }}{{ $mon = replace $n (toString (add1 $i)) $mon }}{{ end -}} {{- range $i, $n := list "sun" "mon" "tue" "wed" "thu" "fri" "sat" }}{{ $dow = replace $n (toString $i) $dow }}{{ end -}} {{- $badField := "" -}}{{- $badValue := "" -}} {{- range $pair := list (list "minute" $min (index $f 0)) (list "hour" $hour (index $f 1)) (list "day-of-month" $dom (index $f 2)) (list "month" $mon (index $f 3)) (list "day-of-week" $dow (index $f 4)) -}} {{- range splitList "," (index $pair 1) -}} {{- if and (not $badField) (not (regexMatch $item .)) }}{{ $badField = index $pair 0 }}{{ $badValue = index $pair 2 }}{{ end -}} {{- end -}} {{- end -}} {{- $domStar := false -}}{{- $dowStar := false -}} {{- range splitList "," $dom }}{{ $p := splitList "/" . }}{{ if and (has (index $p 0) (list "*" "?")) (or (eq (len $p) 1) (le (atoi (index $p 1)) 1)) }}{{ $domStar = true }}{{ end }}{{ end -}} {{- range splitList "," $dow }}{{ $p := splitList "/" . }}{{ if and (has (index $p 0) (list "*" "?")) (or (eq (len $p) 1) (le (atoi (index $p 1)) 1)) }}{{ $dowStar = true }}{{ end }}{{ end -}} {{- $days := list -}}{{- $dowBad := false -}} {{- if not $badField -}} {{- range splitList "," $dow -}} {{- $p := splitList "/" . -}} {{- $step := 1 -}}{{- if eq (len $p) 2 }}{{ $step = atoi (index $p 1) }}{{ end -}} {{- $lo := 0 -}}{{- $hi := 6 -}} {{- if not (has (index $p 0) (list "*" "?")) -}} {{- $lh := splitList "-" (index $p 0) -}} {{- $lo = atoi (index $lh 0) -}} {{- if eq (len $lh) 2 }}{{ $hi = atoi (index $lh 1) }}{{ else if eq (len $p) 1 }}{{ $hi = $lo }}{{ end -}} {{- end -}} {{- if or (gt $hi 6) (gt $lo $hi) (lt $step 1) }}{{ $dowBad = true }}{{ else }}{{ range untilStep $lo (int (add1 $hi)) $step }}{{ $days = append $days (toString (add1 .)) }}{{ end }}{{ end -}} {{- end -}} {{- end -}} {{- if $badField -}} {{- $out = printf "refuse:its %s field %q is not a comma list of numbers, names, ranges, steps or *, the forms Kubernetes and EventBridge Scheduler both read alike: write that field in those forms" $badField $badValue -}} {{- else if $dowBad -}} {{- $out = printf "refuse:its day-of-week field %q names a day outside 0 to 6, Sunday to Saturday, or a range running backwards, which Kubernetes refuses as well: write the days from 0 for Sunday to 6 for Saturday" (index $f 4) -}} {{- else if and (not $domStar) (not $dowStar) -}} {{- $out = "refuse:it restricts both the day of the month and the day of the week, so a run happens on a day matching either, and an EventBridge Scheduler cron expression leaves one of the two unrestricted, so it cannot run on a day matching either: restrict one of the two fields only, and declare a second component for the other" -}} {{- else -}} {{- $domOut := $dom -}}{{- $dowOut := "?" -}} {{- if $domStar }}{{ $domOut = "?" }}{{ $dowOut = join "," (sortAlpha (uniq $days)) }}{{ end -}} {{- if and $domStar $dowStar }}{{ $domOut = "*" }}{{ $dowOut = "?" }}{{ end -}} {{- $out = printf "cron(%s %s %s %s %s *)" (replace "?" "*" $min) (replace "?" "*" $hour) $domOut (replace "?" "*" $mon) $dowOut -}} {{- end -}} {{- end -}} {{- end -}} {{- $out -}}
cpu_millicores{{- $c := toString (optional (optional .infra "compute" dict) "cpu" "") -}} {{- if regexMatch `^[0-9]+m task-ecs 1.0.1 · Каталог Aggrega $c -}}{{ atoi (trimSuffix "m" $c) }} {{- else if regexMatch `^[0-9]+(\.[0-9]{1,3})? task-ecs 1.0.1 · Каталог Aggrega $c -}} {{- $p := splitList "." $c -}}{{- $f := 0 -}} {{- if eq (len $p) 2 }}{{ $f = atoi (substr 0 3 (printf "%s000" (index $p 1))) }}{{ end -}} {{- add (mul (atoi (index $p 0)) 1000) $f -}} {{- end -}}
memory_mib{{- $m := toString (optional (optional .infra "compute" dict) "memory" "") -}} {{- if regexMatch `^[0-9]+Mi task-ecs 1.0.1 · Каталог Aggrega $m -}}{{ atoi (trimSuffix "Mi" $m) }} {{- else if regexMatch `^[0-9]+Gi task-ecs 1.0.1 · Каталог Aggrega $m -}}{{ mul (atoi (trimSuffix "Gi" $m)) 1024 }} {{- end -}}
task_size{{- $found := "" -}} {{- if and .locals.cpu_millicores .locals.memory_mib -}} {{- $mc := atoi .locals.cpu_millicores -}}{{- $mib := atoi .locals.memory_mib -}} {{- range list (list 256 (list 512 1024 2048)) (list 512 (untilStep 1024 4097 1024)) (list 1024 (untilStep 2048 8193 1024)) (list 2048 (untilStep 4096 16385 1024)) (list 4096 (untilStep 8192 30721 1024)) (list 8192 (untilStep 16384 61441 4096)) (list 16384 (untilStep 32768 122881 8192)) (list 32768 (list 61440 122880 249856)) -}} {{- $cpu := index . 0 -}} {{- if and (not $found) (ge (mul $cpu 1000) (mul $mc 1024)) -}} {{- range index . 1 }}{{ if and (not $found) (ge . $mib) }}{{ $found = printf "%d/%d" $cpu . }}{{ end }}{{ end -}} {{- end -}} {{- end -}} {{- end -}} {{- $found -}}
task_cpu{{ if .locals.task_size }}{{ index (splitList "/" .locals.task_size) 0 }}{{ end }}
task_memory{{ if .locals.task_size }}{{ index (splitList "/" .locals.task_size) 1 }}{{ end }}

Сопоставление values

Сопоставление values не объявлено.

Связи

Типизированные рёбра к другим опубликованным сущностям и от них. Ссылка без опубликованной цели отображается как разорванное ребро, а не как ссылка.

Использует

Используется в

Ничто в каталоге не зависит от этой сущности.

Справочник по понятию Recipe →

Каталог Aggrega — открытый указатель компонентов, функций, рецептов и плагинов, которые их рендерят.

Создано на общей дизайн-системе Aggrega.

Конфиденциальность