• Published
  • Reading time13 min
  • Sections11
  • Byheap.page

An image digest identifies bytes, not trust

A Fargate job begins before its first instruction. The runtime must fetch an image, create storage and attach networking. Your security boundary therefore includes the build and launch path, not just the container process. An immutable image digest makes the selected artifact reproducible; it does not tell you who built it, whether its dependencies are safe or whether its behavior is acceptable.

Keep three decisions separate: approve the source and build provenance, inspect vulnerabilities under an explicit policy, then pin the approved digest in a versioned task definition. A clean vulnerability scan is useful evidence about known findings. It is not an assessment of a parser’s business logic or a proof that uploaded code is harmless.

Build dependencies into the image instead of downloading them when the job runs. This reduces mutable inputs and runtime destinations. Review the base image, package locks, architecture and entry point together. A tag that moves between launches changes what you execute even when your application request is identical.

Private execution has two network phases

Startup traffic gets the task ready: ECR authorization, registry access, S3 image layers and log initialization. Job traffic is what the running process can send. A task can need a startup path without needing broad internet access. Conversely, a task that starts successfully has only proved that its startup dependencies work.

Reachability is only one control; endpoint and identity policies still decide what is allowed. AWS endpoint reference ↗AWS official network diagram ↗Diagram by heap.page. The linked AWS application example also includes CloudFront and a load balancer.

On Linux Fargate platform 1.4.0 and later, these paths use the task ENI. A private design can use ECR API and registry interface endpoints, an S3 gateway endpoint for image layers and a CloudWatch Logs interface endpoint. Fargate does not need ECS interface endpoints. Private DNS, routes, security-group rules and endpoint policies must agree; merely creating an endpoint does not complete the path.

Each allowed destination has a specific purpose.
ObservationWhat it meansWhat to check
ECR API and registryAuthenticate and retrieve the selected image manifest.Private DNS and HTTPS to both ECR endpoints; the execution role must be allowed to read the repository.
Regional S3 layer storageECR image layers are stored in S3.Associate the gateway endpoint with the task subnet’s route table; review its policy and the task’s S3 egress rule.
CloudWatch LogsDeliver container output over an allowed network path.Allow the selected log group, endpoint ingress and task egress. Logging is also an intentional data exit.

A private subnet is a routing property, not a complete security policy. A NAT route still provides internet egress. Existing peering, transit gateways, IPv6 routes and proxies can introduce other paths. The example files use a new IPv4 VPC without those attachments; putting the same task into an existing VPC changes that premise.

Separate who launches, who bootstraps and who runs

The trusted launcher authorizes the owner, selects a reviewed task definition and requests one job. Its RunTask, StopTask and PassRole permissions belong outside the untrusted task. Restricting the task role achieves little if a tenant can submit another task definition, replace its role or add a credential-bearing override through your API.

The execution role is used by the ECS runtime for operations such as pulling the image and writing logs. The task role provides AWS permissions to application code. These are different credential paths. A transformation that only consumes supplied bytes may need no task role at all. A job with a task role must be assumed capable of exercising every permission in it.

For a document processor, prefer one authorized input and one bounded output over broad access to a customer’s bucket. A trusted broker can mediate that operation. A presigned URL is another credential, not public plumbing: its object, method and expiry define the delegated access, and its value must stay out of logs. Temporary credentials still need least privilege.

Hardening settings solve different problems

Fargate provides a task isolation boundary. Non-root execution, dropped capabilities, read-only filesystems and storage limits reduce what happens inside that boundary. They complement it; none replaces input authorization, egress policy or lifecycle control.

Review the guarantee and the remaining failure mode together.
ObservationWhat it meansWhat to check
Non-root userReduces privileges held by the application process.A writable mount is not automatically writable by that UID. The default root-owned directory can make /scratch fail with EACCES.
readonlyRootFilesystemPrevents writes to the container’s root filesystem.It does not hide files baked into the image, limit log output or make a separate writable volume read-only.
Dropped Linux capabilitiesRemoves unnecessary process privileges.Do not add CAP_SYS_ADMIN or request privileged execution to make an incompatible tool fit Fargate.
Ephemeral storage limitBounds the task’s configured temporary capacity.It is shared task capacity, not a per-directory quota. Persistent S3 or EFS data has a separate lifetime.

Ask for evidence of each property from the actual task revision and image digest. A non-root process failing to write a root-owned file proves ordinary permissions, not a read-only root filesystem. A useful read-only test uses an image file the chosen UID would otherwise be allowed to modify. A successful scratch write proves a usable mount; it does not prove cross-job cleanup.

Find the failing phase before expanding access

Startup can fail before any application log exists.
ObservationWhat it meansWhat to check
ResourceInitializationErrorA bootstrap dependency failed; application code may never have started.Read the stopped reason, then isolate the named image, logging or secret path. Fix that dependency before changing unrelated permissions.
CannotPullContainerErrorThe runtime could not retrieve the chosen image.Check digest and CPU architecture, ECR authorization, both ECR endpoints and the S3 layer route. A missing route cannot be repaired with AdministratorAccess.
Empty log streamThe stream’s existence does not prove that output was delivered.Correlate task status, log-driver configuration, endpoint connectivity and runtime identity.
Exit code 137The process was killed; the number alone does not establish OOM.Compare memory evidence, stop-request timing, container reason and the shutdown grace period.

Compute lifetime and data lifetime are separate

A task reaching STOPPED is the compute result. Successful job completion additionally needs an acceptable exit status and validated output. Deleting temporary external objects, log groups, images and test endpoints is a separate operation with its own evidence and failure handling.

Interface endpoints have an hourly cost even when no job is running. Logs, images and retained objects can survive a task. Set retention deliberately and include those resources in your cleanup inventory. Do not erase the job record while a launch or stop outcome is unresolved; that record is how an independent reconciler can recover an orphan.

For the lifecycle protocol, continue with deadlines, retries and cancellation. For the limits of a network test, read the network-boundary issue.

Worked example: a PDF converter that never reaches RUNNING

Consider an original design exercise: a service converts an uploaded PDF into page images. The task uses a pinned image in private ECR, a private IPv4 subnet, no public IP and no NAT gateway. The operator creates an ECR registry endpoint and expects the image to arrive privately. The launch is accepted, but the task stops before the application writes a single line. The tempting fix is to add a NAT gateway or give the task role broader S3 access. Neither follows from the evidence yet.

Walk backward from the first missing transition. The runtime needs authorization and a manifest from ECR, then image layers from S3. A registry endpoint alone does not cover the API endpoint or the layer-storage path. Confirm the stopped reason and the image digest first, then inspect private DNS resolution for both ECR endpoints, endpoint security-group ingress from the task security group, task egress and the S3 gateway endpoint’s association with the actual subnet route table. A correct route attached to a different subnet is still a broken dependency.

Now suppose the image pulls, but log initialization fails. That is progress through the dependency graph, not an application regression. The awslogs driver needs its own reachable endpoint and authorized log operations. Precreating the intended log group makes the allowed resource explicit. Granting the application task role permission to create arbitrary groups does not repair a missing execution-role permission. Preserve the original error and change one dependency at a time so that the eventual success has an explanation.

After the task reaches RUNNING, perform a different test: the converter reads a synthetic input and writes a bounded output through the intended data path. Startup success says nothing about whether the converter can access another tenant’s document. Use a second synthetic tenant’s object as a negative authorization control. The deployment is accepted only when both operational dependencies and business authorization behave as designed. This example is a reasoning exercise, not a claim that these resources have been provisioned or penetration-tested.

Model the dependency graph, not a list of open ports

Cloudonaut’s Fargate networking explanation is useful because it starts with the task’s network interface and the relationships between containers. Its older throughput measurements should not become current sizing promises. The durable lesson is to draw the actual paths. For each edge, name the caller, destination, protocol, credential and failure evidence. “HTTPS to AWS” is too broad to review: image retrieval, logging and customer-output upload are three operations with different identities and destinations.

Treat endpoint access as the intersection of reachability and authorization. A security group can allow the connection while an endpoint policy rejects the operation. IAM can allow an operation while a route prevents it from reaching the service. An explicit deny in a resource policy remains relevant even when the execution role has an allow. Record an AccessDenied response differently from a connection timeout; the former is evidence that at least part of the network and service path worked.

Keep infrastructure bootstrap outside the application’s authority where possible. Creating repositories, updating endpoint policies and selecting task definitions are trusted deployment operations. Pulling an approved image is a runtime operation. Reading one job’s input is an application operation. Combining all three in one role makes a startup incident harder to diagnose and gives a compromised parser more power than it needs. A permission should have an owner and a phase, not merely appear on a checklist.

Private networking also has a cost model. Several interface endpoints can cost more than a small, infrequent workload’s compute. A NAT gateway has its own standing and traffic costs. This is a design comparison using current regional rates, expected bytes and availability requirements; there is no universal cheaper option. Do not remove a necessary boundary to save an unspecified amount, and do not deploy a permanent endpoint fleet without accounting for idle time. A disposable lab should have a clear deletion inventory.

The output contract is part of the sandbox boundary

A parser can finish with exit code zero and still produce a dangerous or unusable artifact. Define the output contract before launch: allowed file types, maximum count and total bytes, naming rules, tenant owner and the exact destination prefix. A trusted collector should reject unexpected paths, symlinks or oversized results. Archive extraction needs traversal and expansion limits. If a later service renders HTML or opens a generated document, the untrusted input has crossed another boundary and needs a corresponding validation step.

Separate scratch space from durable results. A read-only root filesystem with one writable scratch mount is easier to reason about than a broadly writable image. But the scratch mount still needs correct ownership for the non-root UID, and the task’s overall ephemeral storage limit is not a quota for each directory. Compressed inputs, expanded page images and temporary files can coexist. Size the task for their combined peak, then enforce application-level input and output limits so one document cannot consume the entire service budget.

Observability should follow this contract. Cloudonaut’s monitoring article distinguishes workload symptoms and infrastructure evidence; apply that by recording phase durations for image preparation, execution and collection. Count rejected output, bootstrap failures and deadline stops separately. Keep document contents, presigned URLs and credentials out of diagnostic events. A large log stream can be both a cost problem and an unauthorized copy of customer data, even when the network policy permits only CloudWatch Logs.

The review question is therefore concrete: can an operator identify the failing edge without granting broader access, and can the service reject a result that violates the declared job contract? Keep one known-good image, one synthetic input and expected output metadata for regression checks. Recheck the relevant edge after changes to endpoint policies, image digests or roles. Rebuilding everything on every investigation makes the result less attributable and increases the number of simultaneous assumptions.

Independent engineering & research

Original analysis by heap.page, informed by the references below. Historical research and vendor accounts are identified explicitly; current AWS behavior is checked against the service documentation.

AWS documentation & further study

Reviewed November 16, 2026. Service availability and limits can change; check the linked documentation for your Region.

Optional implementation files

Original teaching fixtures, checked locally against the documentation. They have not been deployed as a production baseline. Use a disposable account and review the resources, permissions and cost before running them.

Prepaid · USD

Top up balance

Available balance: $0.00

Your balance works across Heap tools. A failed lookup or generation releases its reserved amount.