Container Security covers the practices for securing containers across their lifecycle, from building images to running them in production on ECS, EKS, or Fargate.
user in task definitionawsvpc network mode on ECS for per-task security groupsThe container-specific failure that turns an application bug into an AWS account problem is credential inheritance through the node. On EC2-backed ECS and EKS clusters, every container shares the host's network path to the instance metadata service. If nothing blocks that path, a compromised container, one shell injection or SSRF away, can request the node's instance role credentials from the metadata endpoint. The node role is typically far more powerful than any single workload needs: it can pull every image in the registry, write logs, join the cluster, and often much more, so the attacker escapes the container's intended blast radius without any kernel exploit at all. The whole per-workload identity model (task roles on ECS, IRSA or Pod Identity on EKS) only delivers isolation if pods are also prevented from reaching the node's metadata credentials, via metadata hop limits, network policy, or per-task restrictions. The second recurring failure is the mutable tag: deployments pin to a tag like latest or prod, someone (or something) pushes a different image under the same tag, and what runs in production no longer matches what was reviewed and scanned; ECR tag immutability exists to make that class of swap impossible. The third is scan theater: scan-on-push is enabled, findings accumulate, and nothing gates deployment on the results, so critically vulnerable images ship on schedule. A scan that cannot fail a pipeline is documentation, not a control.
Pull the findings for the image you are about to deploy:
aws ecr describe-image-scan-findings --repository-name my-app --image-id imageTag=1.4.2
You can also address the image by digest with imageDigest=sha256:..., which is the right habit once tag immutability or signing is in play. Note that current ECR basic scanning returns results through this DescribeImageScanFindings API rather than through the scan summary attributes on DescribeImages, so this command is the reliable path for automation. Wire it into your pipeline: fetch findings after push, fail the build above your severity threshold, and route exceptions through an explicit allowlist with expiry dates.
What is the difference between ECR basic and enhanced scanning?
Basic scanning uses AWS native technology with the CVE database, covers operating system packages, and runs on push or on demand. Enhanced scanning hands the job to Amazon Inspector, which scans both OS and programming language packages, rescans continuously as new CVEs are published, and emits EventBridge events when findings change. If your dependencies live in npm, pip, or Maven rather than apt, basic scanning is not seeing most of your real attack surface. One operational caveat: switching between scanning types makes previously established scan results unavailable until you scan again.
Does Fargate make container security AWS's problem?
It moves the host OS, kernel patching, and infrastructure isolation to AWS's side of the shared responsibility model, which removes a real class of risk. Everything inside the task definition remains yours: the image and its vulnerabilities, the task role's permissions, secrets handling, and network exposure. Fargate shrinks the problem; it does not delete it.
Why do task and pod roles matter so much?
Because they are the container equivalent of least privilege. A task or pod role scopes AWS permissions to one workload, so a compromise is bounded by what that workload legitimately needs. Relying on the node role instead gives every container on the host the union of all permissions, which is exactly the blast radius amplification the metadata attack above exploits.
Security practices for Amazon EC2 instances including IMDSv2, security groups, instance profiles, EBS encryption, and patching.
Security considerations for AWS Lambda serverless functions, including execution role permissions, function URL auth, VPC placement, and code signing.
Dividing a network into isolated segments (subnets, VPCs) to limit lateral movement and contain the blast radius of a security breach.
The security principle of granting only the minimum permissions needed to perform a task - no more, no less.
Toc Consulting: AWS Security & Cloud Architecture
Our team helps engineering teams secure and architect AWS the right way: assessment in week one, a prioritized action plan in week two.