Skip to main content

AWS Fargate Launch ExecModule

Overview

FargateLaunchModule version 2.0 submits one real AWS ECS RunTask request for the Fargate launch type. It replaces the legacy placeholder that returned a fake task ARN without contacting AWS.

The module validates a bounded task definition, VPC network override, optional container command and non-secret environment values. A real launch requires an explicit confirmation, a Security Fabric deployment approval, a verified READY AWS IntegrationAccount, sufficient prepaid credits for the authenticated workflow principal, and a stable ECS client token.

AWS credentials never come from workflow input, module configuration JSON, environment overrides, logs, errors, or outputs.

Usage

  1. Register an ECS task definition whose execution role, task role, image, secret references, logging, health checks, and limits have already been reviewed.
  2. Bind a least-privilege verified AWS IntegrationAccount to the ExecModule.
  3. Run with dryRun: true to validate the bounded request and inspect its content-free plan.
  4. Obtain the exact-action deployment approval required by Security Fabric.
  5. Replay the same request with confirmLaunch: true, dryRun: false, and the same idempotencyKey.
  6. Preserve idempotencyKey and taskArn for provider and billing reconciliation.

The module does not create clusters, task definitions, IAM roles, VPCs, subnets, security groups, load balancers, services, or autoscaling policies.

Inputs

InputTypeRequiredDefaultDescription
regionstringYesAWS region such as us-west-2.
clusterstringYesECS cluster name or ARN.
taskDefinitionstringYesRegistered task-definition family, revision, or ARN. The image remains governed by that definition.
subnetIdsarrayYesOne to sixteen subnet IDs used by awsvpc networking.
securityGroupIdsarrayNo[]Up to five security-group IDs.
assignPublicIpbooleanNofalseRequests a public IP for the task ENI when true.
containerNamestringConditionalTask-definition container to override. Required when command or environment is present.
commandarrayNo[]Up to twenty non-empty, single-line command elements, each at most 1,024 characters.
environmentobjectNo{}Up to fifty sorted, non-secret environment entries. Values are single-line strings up to 4,096 characters.
cpuintegerNo512Task CPU override and billing input, from 256 through 16,384 units.
memoryintegerNo1024Task memory override and billing input, from 512 through 122,880 MiB.
idempotencyKeystringYesStable 8–64 character ECS client token using letters, digits, ., _, or -.
confirmLaunchbooleanNofalseExplicit acknowledgement required for provider execution.
dryRunbooleanNofalseValidates and emits a plan without reading credentials, contacting AWS, or billing.

Raw credential fields such as apiKey, password, accessKeyId, secretAccessKey, sessionToken, or credentials are rejected. Secret-like environment names are also rejected; configure sensitive values through ECS task-definition secret references instead.

Outputs

OutputTypeConditionDescription
statusstringAlwaysplanned, launched, or failed.
idempotencyKeystringValid requestECS client token used for reconciliation.
planobjectDry runRegion, identifiers, resource counts, CPU/memory, command count, and environment key names only.
taskArnstringAWS acceptance or post-acceptance billing failureAccepted ECS task ARN.
clusterArnstringAWS acceptance or post-acceptance billing failureCluster ARN returned by ECS.
chargedCreditsnumberSuccessful launch and ledger commitCredits recorded for the authenticated workflow principal.
providerRequestIdstringSuccessful launch and ledger commitBounded AWS request identifier for operational reconciliation.
compensationstringBilling failure after AWS acceptancestop_requested or manual_reconciliation_required.
errorobjectFailureSafe code, message, retryability, and recovery guidance.

Outputs never contain AWS credentials, environment values, command content, provider exception text, or a full balance response.

IntegrationAccount Requirements

Bind exactly one AWS IntegrationAccount through ExecModuleConfig.authConfig:

FieldRequirement
statusMust be READY.
verifiedMust be true.
apiKey SecureFieldAWS access key ID.
password SecureFieldAWS secret access key.

Use a dedicated least-privilege IAM principal. Its policy should be bounded to the approved cluster, task-definition family, task roles, subnets, security groups, and operations:

  • ecs:RunTask
  • ecs:StopTask for billing compensation
  • iam:PassRole only for the task and execution roles referenced by the approved task definition

The current implementation supports an access-key pair. Temporary session credentials and caller-supplied raw credentials are not accepted.

Configuration

The only configuration field is awsAccount, an integrationAccount selector. Launch shape belongs in workflow input so every approved action is explicit and auditable.

The module bills the trusted authenticated workflow principal established by Security Fabric. It does not accept a caller-provided billing account ID.

Operations

Dry run

dryRun: true performs deterministic validation and emits a content-free plan. It does not resolve the IntegrationAccount, query credits, call AWS, or mutate the ledger.

Confirmed launch

A real launch performs these steps once:

  1. Validate the complete request and require confirmLaunch: true.
  2. Require Security Fabric production-deployment authorization and exact-action approval.
  3. Resolve a verified READY AWS IntegrationAccount and read only its SecureFields.
  4. Resolve the trusted workflow principal as the billing account.
  5. Calculate the repository-standard Fargate launch credit cost and require sufficient funds.
  6. Call ECS RunTask once with launchType: FARGATE, count: 1, and the supplied idempotencyKey as clientToken.
  7. Require one returned task ARN and no ECS failure records.
  8. Record the usage transaction for the authenticated principal.

The module does not automatically retry RunTask. AWS client-token idempotency protects deliberate reconciliation, but callers must check ECS before replaying an ambiguous request.

Billing compensation

If AWS accepts a task but ledger recording fails, the module calls StopTask for the returned task ARN. It reports whether the stop was requested. A failed compensation requires manual ECS and credit-ledger reconciliation; the module never claims a successful launch in that state.

Errors and Failure Modes

Error codeMeaningRetryableRecovery
VALIDATION_ERRORA required value, identifier, bound, command, environment field, or credential-like input is invalid.NoCorrect the named input.
CONFIRMATION_REQUIREDA real launch omitted confirmLaunch: true.NoReview a dry run and obtain deployment approval.
INSUFFICIENT_CREDITSThe authenticated principal cannot cover the calculated launch cost.NoAdd credits or reduce task CPU/memory.
AWS_RUN_TASK_FAILEDThe AWS SDK failed before a confirmed task response.No automatic retryReconcile the client token in ECS, then decide whether to replay it.
AWS_RUN_TASK_UNCONFIRMEDAWS returned no accepted task ARN.No automatic retryReconcile the client token before replay.
BILLING_FAILED_COMPENSATEDLedger recording failed and StopTask was requested.NoVerify that ECS stopped the task and reconcile billing.
BILLING_FAILED_RECONCILIATION_REQUIREDLedger recording and automatic stop both failed.NoStop the returned task ARN manually and reconcile the ledger.
FARGATE_EXECUTION_ERRORAn unexpected bounded execution failure occurred.No automatic retryReconcile the client token before replay.

Security Fabric authorization or approval failures halt the protected launch instead of being converted into a normal module success/failure payload.

Example

Validate a private-subnet worker launch:

{
"region": "us-west-2",
"cluster": "production",
"taskDefinition": "worker:42",
"subnetIds": ["subnet-0123456789abcdef0"],
"securityGroupIds": ["sg-0123456789abcdef0"],
"assignPublicIp": false,
"containerName": "worker",
"command": ["java", "-jar", "worker.jar"],
"environment": {
"LOG_LEVEL": "info",
"RELEASE_CHANNEL": "stable"
},
"cpu": 512,
"memory": 1024,
"idempotencyKey": "release-2026-08-14-001",
"confirmLaunch": false,
"dryRun": true
}

Expected result:

{
"status": "planned",
"idempotencyKey": "release-2026-08-14-001",
"plan": {
"region": "us-west-2",
"cluster": "production",
"taskDefinition": "worker:42",
"subnetCount": 1,
"securityGroupCount": 1,
"assignPublicIp": false,
"containerOverride": true,
"commandEntries": 3,
"environmentKeys": ["LOG_LEVEL", "RELEASE_CHANNEL"],
"cpu": 512,
"memory": 1024
}
}

After approval, replay the same bounded input with confirmLaunch: true and dryRun: false.

Notes

  • Pagination: not applicable; one execution submits exactly one task.
  • Limits: subnet, security-group, command, environment, CPU, memory, identifier, and token bounds are validated before any side effect.
  • Idempotency: the caller supplies the stable ECS clientToken. Reuse it only for the same logical request.
  • Rate limits: the module performs one RunTask call and, only after a billing failure, one compensation StopTask call. It does not retry provider writes.
  • API constraints: Fargate requires awsvpc networking and a compatible registered task definition. Container images cannot be overridden by RunTask; update and register a new task-definition revision instead.
  • Destructive behavior: launching compute mutates cloud infrastructure and incurs external/provider cost. Compensation stops a task but cannot undo work that ran before the stop.
  • Secret handling: use ECS task-definition secrets for application secrets. Workflow environment input is deliberately non-secret.
  • Billing: the repository-standard BillingRateProvider calculates credits from requested CPU and memory. A successful output means both AWS acceptance and ledger recording completed.
  • Provider verification boundary: deterministic tests cover validation, request mapping, credential isolation, safe errors, billing order, and compensation. A live AWS launch still requires an authorized account and reviewed cloud resources.
  • Runtime boundary: merged source and published documentation do not update the deployed Workflow Studio catalog until the ValkyrAI backend release exposes version 2 through /v1/modules/metadata.