Compute · AWS SERVICE CHEATSHEET

Amazon Elastic Container Service (ECS) (ECS)

Runs containerized microservices, REST APIs, and background job queues with zero server management using AWS Fargate, integrating with ALBs, Service Discovery, and VPC networking.

Open Interactive ECS Sandbox → Simulate in Architecture Studio

AWS Container Placement

SUBNET

Summary

Fully managed container orchestration service running Docker containers on serverless AWS Fargate or managed EC2 fleets.

When to Use (SAA-C03)

Use for microservices, Dockerized APIs, and batch containers without managing EC2 worker nodes.

Allowed Ingress Connections & Ports

Source ServiceProtocolPortArchitectural Rationale
ALBHTTP / HTTPS80, 443, 8080, 3000Application Load Balancer Layer 7 routing and SSL termination to container target port
NLBTCPAny TCP Port (e.g. 8080, 50051 gRPC)Network Load Balancer high-performance Layer 4 and gRPC streaming traffic
APIGWHTTP80, 8080API Gateway HTTP/REST API integration via VPC Link private integration
SERVICE-DISCOVERYTCP / UDPAny application portInternal microservice-to-microservice communication via AWS Cloud Map Private DNS

Allowed Egress Targets & Ports

Target ServiceProtocolPortData Flow Rationale
RDSTCP3306 (MySQL), 5432 (PostgreSQL)Database read/write connection pool from containerized API handlers
ELASTICACHETCP6379 (Redis)Distributed in-memory caching and session store access
DYNAMODBHTTPS443Low-latency document queries and fast key-value lookups via DynamoDB Gateway Endpoint
ECRHTTPS443Pulling Docker image layers from Amazon ECR private repository via VPC interface endpoints (ecr.api / ecr.dkr)
SECRETSMANAGERHTTPS443Injecting database credentials and API secrets into container environment variables at task launch
NATTCP80, 443Outbound internet egress for third-party SaaS APIs, Stripe, Twilio, and external dependencies

Key Configuration Parameters & AWS Best Practices

ParameterFormat / ExamplePurpose & Rationale
Launch Type (launchType) (Required)FARGATESpecifies the compute infrastructure provider. FARGATE provides serverless container execution where AWS manages hypervisors; EC2 uses customer-managed instances. Why: Determines operational overhead, underlying security isolation model, and pricing structure.
Task CPU Units (taskCpu) (Required)1024 (1 vCPU)The number of CPU units reserved for the Fargate container task (1024 units = 1 vCPU). Why: AWS Fargate requires strict CPU/Memory ratio pairings to allocate virtual hardware slots.
Task Memory (taskMemory) (Required)2048 (2 GiB RAM)The hard limit of memory allocated to the container task in MiB. Why: Containers exceeding this memory threshold trigger Linux OOM-killer termination.
Container Port (containerPort) (Required)8080The listening port exposed inside the Docker container image (EXPOSE in Dockerfile). Why: In awsvpc networking mode, the task ENI maps traffic directly to this container port without host port translation.
Target Group ARN (targetGroupArn) (Required)arn:aws:elasticloadbalancing:...:targetgroup/ecs-api-tg/...The Application Load Balancer Target Group configured with target type "ip" to route traffic directly to the task private IP. Why: Enables ALB to discover dynamic task IP addresses as tasks scale up and down.
Task Security Groups (securityGroupIds) (Required)[sg-ecs-tasks]Security groups attached directly to the task Elastic Network Interface (awsvpc networking). Why: Mandatory firewall boundary: allows inbound traffic strictly from the ALB security group on containerPort.
Container Image URI (ecsImage)123456789012.dkr.ecr.us-east-1.amazonaws.com/payment-service:v2.1Docker image repository address in Amazon ECR or public registry. Why: ECS task execution agent pulls this container image layer bundle on task launch.
Desired Task Count (ecsDesiredCount)2The continuous number of healthy running task instances the ECS service maintains. Why: ECS service scheduler automatically replaces stopped or unhealthy tasks to preserve this target count.
Task Execution Role (ecsTaskExecutionRoleArn)arn:aws:iam::123456789012:role/ecsTaskExecutionRoleGrants the ECS container agent permission to pull images from Amazon ECR and send logs to CloudWatch. Why: Without this role, tasks in private subnets cannot authenticate with ECR to download image layers.
Task Role (ecsTaskRoleArn)arn:aws:iam::123456789012:role/PaymentAppTaskRoleGrants the application code inside the container access to AWS APIs (DynamoDB, S3, SQS, KMS). Why: Enforces least privilege STS credential dispensing to application processes without hardcoded credentials.
Cluster Name (ecsClusterName)production-microservicesLogical grouping of services and tasks. Why: Organizes application environments (e.g. prod-cluster, staging-cluster) for unified metrics and IAM boundaries.

Practice Labs Using Amazon Elastic Container Service (ECS)

SAA-C03-GITHUB-OIDC-CICD

Enterprise Cloud Security: GitHub Actions Keyless OIDC CI/CD to Private VPC

Replace static IAM credentials with GitHub OIDC Identity Provider and IAM Role with AssumeRoleWithWebIdentity …

BUILD-10

Build: Enterprise Zero-Trust PrivateLink Service Connection

Build a two-VPC architecture with an Interface VPC Endpoint in the Consumer VPC and a Network Load Balancer in…

Frequently Asked Questions

Where does Amazon Elastic Container Service (ECS) live inside an AWS VPC architecture?

Valid container placement: SUBNET. Runs containerized microservices, REST APIs, and background job queues with zero server management using AWS Fargate, integrating with ALBs, Service Discovery, and VPC networking.

When should I use Amazon Elastic Container Service (ECS) on the AWS SAA-C03 exam?

Use for microservices, Dockerized APIs, and batch containers without managing EC2 worker nodes.

Can I simulate Amazon Elastic Container Service (ECS) packet routing without an AWS account?

Yes. CloudTracer simulates Amazon Elastic Container Service (ECS) along with 53 AWS services directly in your browser and exports production Terraform HCL.

More Compute Cheatsheets

EC2 Instance → Auto Scaling Group → Lambda Function →