Esta página foi traduzida automaticamente. Leia o original em inglês.

Recipe

task-ecs

The generic ephemeral compute primitive as an Amazon ECS task on Fargate that an EventBridge Scheduler schedule starts, rendered as a CloudFormation fragment the provider assembles into the boundary's stack. 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, task definition and 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.

Versão

1.0.01.0.1

Procedência

OficialAssinado por uma identidade de assinatura que este catálogo reconhece como publicador oficial.
Digest do conteúdo
sha256:aa6a30be8eac6fcdb2c9b2d182eae712509715049ce5370a4e1c55cce3b64866
Publicado
2026-11-10T10:18:01Z
Identidade de assinatura
https://token.actions.githubusercontent.com/https://github.com/aggrega-ai/aggrega-hub/.github/workflows/catalog-publish-sign.yml@refs/heads/main

Assinatura

  • Oficialapplication/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:e3a34156c0f43aaaede77f5e9d3882ab6ec500e829c0e5fca0b51d1f5fe77d8d

Referência nesta versão

oci://hub.aggrega.ai/recipe/cloudformation/task-ecs:1.0.0
Destino
—
Implementa
core/compute/task:1.0.0

Fornece

Modelos de ponteiros determinísticos que esta receita liga para os consumidores.

Nenhum modelo provides declarado.

Workload

Nenhum modelo de carga de trabalho declarado.

Variáveis locais

NomeModelo
logical_id{{ capitalizedWords .context.instance_id }}
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.0 · Catálogo 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.0 · Catálogo Aggrega $c -}}{{ atoi (trimSuffix "m" $c) }} {{- else if regexMatch `^[0-9]+(\.[0-9]{1,3})? task-ecs 1.0.0 · Catálogo 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.0 · Catálogo Aggrega $m -}}{{ atoi (trimSuffix "Mi" $m) }} {{- else if regexMatch `^[0-9]+Gi task-ecs 1.0.0 · Catálogo 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 }}

Mapeamento de valores

Nenhum mapeamento de valores declarado.

Relações

Arestas tipadas de e para outras entidades publicadas. Uma referência sem destino publicado é exibida como uma aresta quebrada em vez de um link.

Usa

Usado por

Nada no catálogo depende desta entidade.

Referência do conceito Recipe →

O catálogo Aggrega — um índice aberto de componentes, funcionalidades, receitas e dos plugins que os renderizam.

Criado com o sistema de design compartilhado do Aggrega.

Privacidade