ECS runs tasks from container definitions. These sections explain how services maintain tasks, deploy changes, scale capacity, and expose failure details.
Task definitions, tasks, and services
An ECS task definitionThe JSON configuration describing the containers and resources for an application. describes how to run an application in containersAn isolated process that runs an application packaged with its dependencies., which package code and its dependencies. A task is a running copy; a service keeps the requested number of copies available.
How it works
- Write a DockerfileA file of instructions describing how to build and start an image., the instructions for building an imageA package used to create containers with application code and its dependencies.. Use
docker build, test it withdocker run, then usedocker tagand push the image to an ECR repository, a store for container images. - Reference that image in a JSON task definition. Group containers that run together and set their CPU, memory, networking, logging, roles, and volumes. A volumeStorage exposed to containers through a mounted directory. exposes storage as a directory in a container.
- Run a standalone task for finite work, or create a service for continuous work. EventBridge rules can launch tasks for events; EventBridge Scheduler launches them on a schedule.
- Choose
REPLICAto maintain a desired countThe number of tasks a service is configured to maintain.. On eligible container instances,DAEMONplaces one task per instance. Fargate does not supportDAEMON. - For a service, ECS replaces stopped tasks.
StopTaskstops the selected task without reducing the service’s desired count.
Image layersA read-only part of an image built from a Dockerfile instruction. are read-only. The container adds a disposable writable layerThe private changeable storage added to a container and discarded when it is replaced., so changes there disappear when the container is replaced. Choose storage deliberately:
| Storage | Use |
|---|---|
| EFS | Shared persistent files for Linux tasks on EC2 or Fargate |
| EBS | Block storage; service-task volumes are ephemeral, standalone-task volumes can persist |
| S3 Files | File-system access to S3 data; requires a task roleAn assumable identity that supplies temporary credentials for allowed AWS operations. and encryption in transit |
| Bind mount | Temporary files shared by containers in the same task |
S3 Files launched in April 2026.
A Fargate service can use an Application Load Balancer for HTTP/HTTPS, a Network Load Balancer for TCP/UDP, or a Gateway Load Balancer for virtual appliances such as firewalls. Classic Load Balancers are unsupported. Fargate requires awsvpc networking, which gives each task a network interfaceThe network connection associated with a task that uses awsvpc networking., its connection to the network. Use ip targets for load balancer target groupsA logical set of destinations that receive routed load balancer traffic..
Exam cues
- If the question says a nightly ECS job must exit when done, think scheduled standalone task, because a service maintains continuous task availability.
- If the question says stopping an ECS service task creates another, think desired count, because the service replaces stopped tasks.
- If the question says replacement Linux tasks need the same shared files, think EFS, because container writable layers do not persist.
Remember
- A task definition groups containers and their runtime settings.
DAEMONmeans one task per eligible instance; Fargate requiresREPLICAfor services.- EFS on Fargate Linux requires platform version 1.4.0 or later.
- Containers share the host kernel; VMs each run a guest operating system.
Trap: Stopping a service task does not stop the service from maintaining its desired count.
A service task stops or fails.
The service scheduler launches a replacement to maintain its desired count.
Da documentação da AWS (29)
- A task definition is a JSON description of the containers and settings used to run an application.
- Task definitions specify container images, CPU, memory, networking, logging, volumes, and an application IAM role.
- A task is an instance of a task definition inside a cluster.
- A service maintains its desired task count and replaces failed or stopped tasks.
- Standalone tasks suit batch jobs and work that runs once rather than continuously.
- EventBridge rules can target ECS tasks, and EventBridge Scheduler can start tasks on a schedule.
- StopTask stops the specified running task.
- REPLICA maintains a desired task count across a cluster.
- DAEMON places one task on every eligible active container instance and is unsupported on Fargate.
- A Dockerfile describes an image build; docker build builds an image, docker run starts it, and docker tag names it for a registry.
- An image can be tested locally, tagged with an ECR repository URI, and pushed to ECR for a task definition to reference.
- Image layers are read-only; each container adds its own writable layer.
- Changes in a container writable layer do not survive container replacement; persistent data needs external storage.
- EFS provides shared persistent file storage for Linux tasks on EC2 and Fargate.
- Fargate Linux supports EFS starting with platform version 1.4.0.
- An S3 Files volume mounts a file-system interface to S3 bucket data using s3filesVolumeConfiguration.
- S3 Files volumes require a task IAM role and enforce encryption in transit.
- EBS task volumes support EC2 and Fargate; service-task volumes are ephemeral, while standalone-task volumes can persist.
- Bind mounts can share files between containers in a task and are an ephemeral storage option.
- Fargate services support Application, Network, and Gateway Load Balancers.
- Application Load Balancers route HTTP/HTTPS; Network Load Balancers route TCP/UDP; Gateway Load Balancers serve virtual appliances.
- Classic Load Balancers are not supported for Fargate services.
- Fargate requires awsvpc networking; its tasks have an elastic network interface.
- Fargate service load balancer target groups must use ip targets rather than instance targets.
- Containers package an application with the dependencies needed to run it.
- A task volume exposes a storage location to its containers.
- Amazon S3 Files launched in April 2026.
- A container definition can reference an image by digest (repository@sha256:...), so every task runs exactly that image.
- Containers use the host operating system kernel directly, while each virtual machine runs its own guest operating system.
Task and execution roles
ECS separates application permissions from the permissions needed to start a task. An IAM roleAn assumable identity that supplies temporary credentials for allowed AWS operations. is an assumable identity with permissions and temporary credentials; its trust policyA role policy specifying which principal may assume the role. defines who may assume it.
How it works
- On EC2, attach a containerAn isolated process that runs an application packaged with its dependencies. instance role through an instance profileThe container used to attach an IAM role to an EC2 instance., the attachment used to give an EC2 instance a role. The agent uses it to register with ECS.
- Configure an execution role for agent operations such as Fargate imageA package used to create containers with application code and its dependencies. pulls, log delivery, and secret injection.
- Give the task role the permissions that application code needs, such as S3 reads. The application receives task credentials; execution-role credentials are reserved for the agent.
| Role | User of the credentials | Typical purpose |
|---|---|---|
| Container instance | ECS agent on EC2 | Register and communicate with ECS |
| Task execution | ECS or Fargate agent | Pull images, deliver logs, inject secrets |
| Task | Application code | Call AWS APIs at runtime |
For injection, grant secretsmanager:GetSecretValue for Secrets Manager or ssm:GetParameters for Parameter Store. Add kms:Decrypt for a customer managed encryption key. Application code that retrieves a secret itself needs the corresponding permissions on its task role.
For a private registryA store from which container images can be pushed or pulled. outside AWS, set repositoryCredentials and grant the execution role access to the Secrets Manager registry secret. Add kms:Decrypt if it uses a customer managed key.
Injected Secrets Manager environment variables are read at container startup. After rotation, launch a new task or force a new service deployment. Injecting a specific JSON key or version needs Fargate Linux platform 1.4.0 or later, or Windows platform 1.0.0.
Exam cues
- If the question says a running ECS application is denied S3 access, think task role and resource policies, because the application uses task credentials.
- If the question says a Fargate task cannot inject a secret at startup, think execution-role permissions, because the agent retrieves the referenced secret.
- If the question says an EC2 host cannot join an ECS cluster, think container instance role, because registration is an agent operation.
- If an ECS container still uses an old injected secret after rotation, think a new deployment, because the environment value is set at startup.
- If the question requires task isolation, think Fargate or isolated tasks on ECS Managed Instances. Ordinary containers sharing an EC2 host can potentially access other task credentials and instance metadata.
Remember
- Task and execution roles trust
ecs-tasks.amazonaws.com; EC2 instance roles trustec2.amazonaws.com. AmazonECSTaskExecutionRolePolicycovers common execution operations, not every secret or feature.- Task-role SDK credentials do not inherit the instance role’s permissions. CloudTrail records task context with
taskArn. - Limit task-role trust with
aws:SourceAccountoraws:SourceArnto reduce confused deputyA security problem in which an unauthorized actor induces a more privileged entity to act on its behalf. risk, where a service is misused to act on another account’s behalf. A specific cluster ARN is not supported; use a wildcard for clusters. - Nitro Sandboxes for ECS tasks launched in November 2026. A Nitro Sandbox is a hardware-isolated virtual machine; isolated tasks on ECS Managed Instances each receive one.
Trap: A successful image pull does not establish that the application has permission to access its data.
Da documentação da AWS (25)
- A task IAM role supplies temporary AWS credentials to application code inside the task.
- SDK calls using a task role do not inherit the EC2 container instance role permissions.
- Task-role credential sessions include taskArn context for CloudTrail auditing.
- The task execution role supplies agent permissions; its credentials are not directly available to application containers.
- The execution role is used for Fargate ECR image pulls and awslogs delivery, and for referenced secrets.
- AmazonECSTaskExecutionRolePolicy covers common execution-role operations; additional features can require extra permissions.
- Injected Secrets Manager secrets require secretsmanager:GetSecretValue on the execution role.
- Referenced Parameter Store parameters require ssm:GetParameters on the execution role.
- Secret decryption with a customer managed KMS key requires kms:Decrypt.
- The task execution role trusts ecs-tasks.amazonaws.com.
- The EC2 container instance role lets the ECS agent register the instance and call ECS APIs.
- AmazonEC2ContainerServiceforEC2Role is the managed policy for the EC2 container instance role.
- The EC2 container instance role trusts ec2.amazonaws.com and is attached through an instance profile.
- The task IAM role trusts ecs-tasks.amazonaws.com.
- An IAM role is an assumable identity with permissions and temporary security credentials.
- A trust policy identifies the principals permitted to assume a role.
- ECS recommends aws:SourceAccount or aws:SourceArn in the task-role trust policy; SourceArn cannot be restricted to a specific cluster and must use a wildcard for clusters.
- Fargate isolates each task; on EC2, containers can potentially access credentials of other tasks and instance metadata on the same host.
- Fargate private registry authentication uses repositoryCredentials in the task definition; the execution role needs secretsmanager:GetSecretValue for the registry secret.
- A private registry secret encrypted with a customer managed KMS key also requires kms:Decrypt on the execution role.
- A Secrets Manager value injected as an environment variable is read at container startup and does not refresh on rotation; launch a new task or force a new service deployment.
- Injecting a specific Secrets Manager JSON key or version on Fargate requires Linux platform version 1.4.0 or later, or Windows platform version 1.0.0.
- ECS Managed Instances support isolated tasks in separate Nitro Sandboxes on the same EC2 instance, with hardware-enforced task isolation.
- AWS announced Nitro Sandboxes for ECS tasks in November 2026.
- With the awslogs driver on EC2 container instances, logs:CreateLogStream and logs:PutLogEvents must be on the container instance role, or on the task execution role when the task has one.
Rolling deployments
An ECS rolling deployment replaces service tasks while retaining a configured amount of healthy capacity. An image digestA content identifier used to select a particular container image. is a content identifier for an imageA package used to create containers with application code and its dependencies.; resolving tags to digests keeps a deployment’s tasks on the same image.
How it works
- ECS starts replacing tasks under two bounds:
minimumHealthyPercentis the healthy floor, andmaximumPercentis the ceiling for running or pending tasks. - Multiply each percentage by
desiredCount. Round the minimum up and the maximum down. The settings must leave room to start or stop a task. - Supply capacity for any extra tasks. With four desired tasks and a maximum of 200%, ECS can start four replacements before stopping the old four.
- To adopt a changed image tag, force a new deployment. Updated digests apply to new tasks; existing tasks keep their images.
A Fargate platform version identifies its kernel and containerAn isolated process that runs an application packaged with its dependencies. runtime. A patched revisionAn updated runtime release within a Fargate platform version. updates that version. Changing the selected version requires a deployment. Scale-outAdd tasks or instances to handle more work. alone retains the current deployment’s version and uses its latest revision. Forcing a deployment replaces running tasks so they can receive a newer revision.
Exam cues
- If the question says an ECS deployment cannot start or stop tasks, think percentage bounds and capacity, because rounding can leave no legal move.
- If the question says an image was pushed under the same tag, think force a new deployment, because existing tasks retain their images.
- If the question says Fargate scale-out must upgrade the platform version, think service update and deployment, because scale-out retains the current version selection.
Remember
REPLICAdefaults: minimum 100%, maximum 200%.- Minimum rounds up; maximum rounds down.
maximumPercentincludesRUNNINGandPENDINGtasks.
Trap: Selecting a new image tag or platform version does not modify the runtime of an already running task.
Da documentação da AWS (13)
- Rolling deployments replace existing ECS service tasks with new tasks under deployment configuration limits.
- minimumHealthyPercent sets the healthy task floor relative to desiredCount, rounded up.
- maximumPercent caps RUNNING and PENDING tasks relative to desiredCount, rounded down.
- REPLICA services default to minimumHealthyPercent 100 and maximumPercent 200.
- Deployment percentages must allow ECS to start or stop at least one task; otherwise deployment cannot progress.
- Starting additional deployment tasks requires sufficient cluster resources.
- With desiredCount 4 and maximumPercent 200, ECS may start four replacement tasks before stopping the original four if capacity permits.
- ECS resolves image tags to digests by default and uses the established digests for other service tasks.
- Forcing a new deployment establishes updated image digests for new tasks without altering already running tasks.
- A Fargate platform version describes its kernel and container runtime; a revision is an update within that version.
- Changing a Fargate service platform version requires a deployment.
- Scaling an unchanged Fargate service uses the current deployment platform version and the latest revision of that version.
- A forced deployment can start Fargate tasks on a newer platform version revision.
Service auto scaling
ECS Service Auto Scaling adjusts how many tasks a service should run as demand changes. Application Auto Scaling manages this task count; EC2 instance capacity is managed separately through capacity providers.
How it works
- Set service minimum and maximum capacity, the allowed task-count bounds, and choose a scaling policy.
- For target tracking, select a metric and target. Application Auto Scaling manages alarms and changes capacity to approach that target. ECS publishes CPU and memory metrics every minute.
- For queue workers, measure backlog per taskThe queued work available for each running worker task., the queued work divided across workers. Use a custom SQS metric to scale with that work.
- Allow a cooldownA waiting period that gives a scaling activity time to take effect., a wait for a prior change to take effect. Scale-outAdd tasks or instances to handle more work. can interrupt a scale-inRemove tasks or instances when less capacity is needed. cooldown when demand rises.
| Policy | Trigger |
|---|---|
| Target tracking | Keep a metric near a target |
| Step scaling | Apply an adjustment based on an alarm breach |
| Scheduled | Change capacity at a specified date and time |
| Predictive | Anticipate recurring patterns from historical load |
Exam cues
- If the question says an ECS service should maintain average CPU near a target, think target tracking, because it manages the alarms and adjustments.
- If the question says SQS worker demand depends on queued work, think backlog per task, because it relates outstanding work to workers.
- If the question says one of several target tracking policies requests scale-out, think scale-out can proceed, because any policy can request it.
Remember
- Minimum capacity 0 permits scale to zero; scaling out from zero needs a demand data point.
- Target tracking does nothing with insufficient metric data.
- With multiple target tracking policies, any may request scale-out; all enabled scale-in policies must agree to scale in.
ALBRequestCountPerTargettarget tracking is unsupported for blue/green deployments.
Trap: Increasing desired task count does not itself add EC2 hosts. A managed capacity provider scales the instances.
Da documentação da AWS (14)
- ECS Service Auto Scaling uses Application Auto Scaling to change the desired number of service tasks.
- ECS publishes service average CPU and memory metrics for scaling.
- ECS sends its scaling metrics to CloudWatch at one-minute intervals.
- Target tracking chooses a metric target and manages the alarms and task-count adjustments automatically.
- Step scaling changes task count using configured adjustments based on the size of an alarm breach.
- Scheduled scaling changes service capacity based on a date and time.
- Predictive scaling uses historical load to identify daily or weekly traffic patterns.
- SQS worker services can scale using a custom backlog-per-task metric.
- A minimum capacity of 0 permits scale to zero; target tracking waits for a demand data point before scaling out from zero.
- A cooldown is a wait for a scaling activity to take effect; scale-out can interrupt a scale-in cooldown.
- Target tracking takes no scaling action when the metric has insufficient data.
- With multiple target tracking policies, any policy can request scale-out; scale-in requires every policy with scale-in enabled to agree.
- ALBRequestCountPerTarget target tracking is unsupported for the blue/green deployment type.
- EC2 cluster auto scaling uses a managed Auto Scaling group capacity provider to change instance capacity.
Capacity providers
A capacity provider connects ECS task demand to the compute that runs it. For EC2, managed scaling adjusts an Auto Scaling groupA collection of EC2 instances whose count can change to provide the needed capacity., the collection of hosts that can grow or shrink as tasks need capacity.
How it works
- Associate an Auto Scaling group capacity provider with the ECS cluster. Use it in the service’s capacity provider strategyRules defining how tasks are distributed among available capacity providers., the task distribution rules across providers.
- Satisfy
base, a minimum task count assigned to one provider. Distribute remaining tasks byweight, a relative share. BaseA minimum task count placed on one provider before weighted task distribution. defaults to 0; at least one weightA relative share of tasks assigned to a capacity provider after satisfying its base. must be positive. - Enable managed scaling so ECS adjusts the Auto Scaling group as tasks need EC2 capacity. Keep
MaxSizeabove 0 so the group can grow. - Set
targetCapacitybelow 100% when tasks need spare host capacity.
A cluster can contain ASG and Fargate providers, but one strategy cannot mix those types. FARGATE_SPOT uses spare capacity for work that tolerates interruption. It gives a two-minute warning; unavailable Spot capacity does not automatically fall back to on-demand capacity.
Exam cues
- If the question says ECS service scale-outAdd tasks or instances to handle more work. leaves tasks waiting for EC2 resources, think managed capacity provider, because desired task count and host count are separate controls.
- If the question says a strategy needs a minimum task count on one provider, think
base, because ECS meets it before distributing by weight. - If the question says tasks should start without waiting for hosts, think a target below 100%, because it retains spare capacity.
Remember
basedefaults to 0; at least one provider weight must be positive.- A group that cannot grow can leave tasks in
PROVISIONING.
Trap: Fargate Spot does not promise automatic on-demand replacement when Spot capacity is unavailable.
ECS managed scaling adjusts the Auto Scaling group desired capacity from task demand.
The group launches instances that register with ECS to host waiting tasks.
Da documentação da AWS (11)
- An Auto Scaling group capacity provider connects ECS task placement with EC2 instance capacity.
- Managed scaling lets ECS control the Auto Scaling group using a target tracking policy and CloudWatch alarms.
- The Auto Scaling group MaxSize must exceed 0 to allow scale-out.
- If an Auto Scaling group cannot grow to accommodate tasks, tasks cannot progress beyond PROVISIONING.
- Associate a capacity provider with the cluster before using it in a capacity provider strategy.
- A strategy base places a minimum number of tasks on one provider before weight distribution; base defaults to 0.
- Strategy weight controls relative task distribution after base; at least one provider must have positive weight.
- A cluster can have both ASG and Fargate capacity providers, but a strategy cannot mix those two provider types.
- FARGATE_SPOT uses spare capacity and gives a two-minute interruption warning.
- Fargate does not automatically replace unavailable Spot capacity with on-demand capacity.
- A targetCapacity below 100% retains spare instance capacity for future tasks.
Task troubleshooting
ECS task troubleshooting connects scheduler messages, stop reasons, and application logs. Each explains a different part of a failure: placement, task termination, or application behavior.
How it works
- For a service problem, read the service event log first. It reports scheduling and instance-health issues.
- Inspect the stopped task with
DescribeTasks. ReadstopCode,stoppedReason, and containerAn isolated process that runs an application packaged with its dependencies.reasonandexitCode. On EC2, inspect agent and container runtime logs as well. - Configure each application’s
logConfigurationwithawslogs. Standard outputThe stream an application uses for ordinary process output. (STDOUT) and standard errorThe stream an application uses for process error output. (STDERR) are the process’s normal and error output streams; the driver forwards them directly to CloudWatch Logs without a separate CloudWatch Logs agent for those streams. - Set the log groupA collection of log streams with common retention, monitoring, and access settings. and Region, plus a stream prefix on Fargate. A log group holds related streams; a stream holds one source’s log events. Grant
logs:CreateLogStreamandlogs:PutLogEvents. On a custom EC2 imageA package used to create containers with application code and its dependencies., advertiseawslogsthroughECS_AVAILABLE_LOGGING_DRIVERS. - Capture
ECS Task State Changeevents in EventBridge. Filter for stopped tasks and forward to SNS, a notification destination. Events includestoppedReasonandstopCode; retrieve health separately throughDescribeTasks. - For interactive diagnosis without inbound SSH, enable ECS Exec on new tasks. It uses Systems Manager Session Manager and requires task-role
ssmmessageschannel permissions. For private endpoint access, add thessmmessagesinterface endpoint and, when using a KMS key, a KMS endpoint.
| Application output | Collection approach |
|---|---|
| STDOUT and STDERR | awslogs forwards directly to CloudWatch Logs |
| Files inside the task | Shared volumeStorage exposed to containers through a mounted directory. plus a Fluent Bit sidecarA helper container that runs alongside the application, for example to forward log files., a helper container that forwards the files |
| Logs for external destinations | FireLens router using Fluent Bit or Fluentd |
Match the stop message to the failing operation:
| Symptom | Check |
|---|---|
| Image pull failure | Image existence, registryA store from which container images can be pushed or pulled. connectivity, and pull permissions; Fargate uses the execution roleAn assumable identity that supplies temporary credentials for allowed AWS operations., EC2 the instance role |
| Secret initialization failure | Secret existence, agent execution-role permissions, and service connectivity |
| Logging-driver initialization failure | Whether the named CloudWatch log group exists |
OutOfMemoryError |
Container memory usage against its task-definition allocation and host constraints |
Exam cues
- If the question says an ECS service cannot place tasks, think service events, because the scheduler reports placement failures there.
- If the question says the application only writes files, think shared-volume sidecar, because
awslogsforwards output streams. - If the question says alert when ECS tasks stop, think EventBridge task-state events and SNS, because the events include stop reasons.
- If the question says diagnose a running container without SSH, think ECS Exec, because it connects through Systems Manager Session Manager.
Remember
- Stopped tasks appear in the console for one hour.
awslogs-create-groupdefaults to false; automatic creation needslogs:CreateLogGroup.- FireLens starts before dependent application containers and stops after them by default.
- ECS Exec needs a writable container file system, runs commands as root, and has a fixed 20-minute idle timeout. IPv6-only tasks are not supported.
Trap: A task-state event does not include task health. Call
DescribeTasksfor that information.
ECS emits a task-state event including the stop reason.
An EventBridge rule forwards matched stopped-task events to an SNS notification target.
Da documentação da AWS (31)
- The ECS service event log is the first diagnostic source for service scheduling and instance-health problems.
- DescribeTasks exposes stopped task details including stopCode, stoppedReason, and container reason.
- ECS container details can include exitCode and reason for diagnosing a stopped container.
- Stopped tasks remain visible in the ECS console for one hour.
- On EC2, container runtime and ECS agent logs provide host-level diagnostic information.
- The awslogs driver forwards container STDOUT and STDERR to CloudWatch Logs.
- Fargate container logs require logConfiguration in the task definition to enable awslogs.
- Custom EC2 AMIs must advertise awslogs through ECS_AVAILABLE_LOGGING_DRIVERS when starting the ECS agent.
- awslogs-region selects the destination Region, awslogs-group selects a log group, and awslogs-stream-prefix is required on Fargate.
- awslogs-create-group defaults to false; automatic creation requires logs:CreateLogGroup permission.
- Container log delivery requires logs:CreateLogStream and logs:PutLogEvents permissions.
- An application can write log files to a shared task volume that a Fluent Bit sidecar reads with its tail input and forwards to CloudWatch.
- FireLens uses Fluent Bit or Fluentd to route ECS container logs to AWS services or external destinations.
- ECS starts the FireLens container before dependent application containers and stops it after them by default.
- ECS Task State Change events for stopped tasks contain stoppedReason and stopCode.
- An EventBridge rule can match stopped ECS task events and send an SNS alert.
- Task health is absent from ECS task state-change events; DescribeTasks can retrieve it.
- The awslogs Docker logging driver sends container output directly to CloudWatch Logs without a separate CloudWatch Logs agent for those streams.
- Image pull failures can result from a missing image, pull permissions, or connectivity to the registry.
- Fargate image-pull permissions use the task execution role; EC2 image-pull permissions use the container instance role.
- Secret initialization failures can indicate missing secrets, missing execution-role permissions, or network connectivity failures.
- A logging-driver initialization failure can be caused by a missing CloudWatch log group named in the task definition.
- OutOfMemoryError can indicate that container processes exceeded task-definition memory allocation or host operating-system constraints.
- A CloudWatch Logs group contains log streams with common retention, monitoring, and access settings.
- A CloudWatch Logs stream is a sequence of events from the same log source.
- ECS Exec uses Systems Manager Session Manager to run commands in containers without opening inbound ports or managing SSH keys; it must be enabled for new tasks.
- ECS Exec needs ssmmessages CreateControlChannel, CreateDataChannel, OpenControlChannel, and OpenDataChannel permissions on the task IAM role.
- ECS Exec commands run as root and require a writable container file system for the Systems Manager agent; readonlyRootFilesystem is not supported.
- ECS Exec using interface VPC endpoints requires the Systems Manager ssmmessages endpoint; a KMS interface endpoint is also required when using a KMS key for encryption.
- ECS Exec has a fixed 20-minute idle timeout and does not support IPv6-only tasks.
- On EC2 and external instances, the ECS agent pulls the task image from the registry and caches it. With ECS_IMAGE_PULL_BEHAVIOR set to default, a failed pull falls back to the cached image; with always, the task fails instead.
ECS Anywhere
ECS Anywhere extends an ECS cluster to servers you own: the same task definitionsThe JSON configuration describing the containers and resources for an application. and console, with the containersAn isolated process that runs an application packaged with its dependencies. running on premises.
How it works
- Register an on-premises server or VM with Systems Manager and the ECS cluster (the install script adds the SSM and ECS agents).
- ECS schedules tasks on it with the
EXTERNALlaunch type.
Exam cues
- If the question says run ECS tasks on premises with one control plane, think ECS Anywhere.
- If the question says on-premises tasks must receive load-balanced inbound traffic, ECS Anywhere is a poor fit.
Remember
- External instances join an existing ECS cluster.
- No service load balancing; best for outbound or processing work.
Trap: ECS Anywhere and EKS Anywhere differ: ECS Anywhere keeps the AWS-managed ECS control plane, while EKS Anywhere puts the Kubernetes control plane on your hardware.
Da documentação da AWS (2)
Deployment circuit breaker and alarms
The ECS deployment circuit breaker stops a release that cannot reach a stable running state. CloudWatch deployment alarms catch failures expressed as application metrics, such as increased latency.
How it works
- Enable the circuit breaker under the ECS deployment controllerThe mechanism that manages how a service deploys new versions.. It first watches whether tasks reach
RUNNING, then evaluates load balancer, Cloud Map service-discovery, and containerAn isolated process that runs an application packaged with its dependencies. health checks. Service discoveryA way for an application to locate the services it needs. is how applications locate their peers. - Fail the deployment when the configured task-failure threshold is reached. The default is
BOUNDED_PERCENT: 50% of the latest desired countThe number of tasks a service is configured to maintain., rounded up and limited to 3 through 200. - Choose
UNBOUNDED_PERCENTfor an uncapped percentage, orCOUNTfor a fixed failure count.resetOnHealthyTask: trueresets the counter on a healthy task; false accumulates failures. - With rollbackReturning an application deployment to a previous revision after a problem. enabled, ECS returns to the most recent
COMPLETEDdeployment. If none exists, it stalls without launching new tasks. - Add CloudWatch alarms for application metrics. With both methods enabled, the first to meet its failure condition fails the release. That method must have rollback enabled to initiate recovery.
Native blue/green setup also supports circuit-breaker rollback. The October 2026 VPC Lattice announcement describes the same protection for native blue/green, linear, and canary deployments.
Exam cues
- If the question says ECS tasks cannot start or pass health checks, think circuit breaker, because it watches task startup and health.
- If the question says tasks run but application latency rises, think deployment alarm, because task startup alone does not measure that metric.
- If the question says ECS cannot find a rollback target, think missing
COMPLETEDdeployment, because rollback requires one.
Remember
- The circuit breaker belongs to the ECS controller. Native blue/green also supports it; CodeDeploy uses separate deployment controls.
- Default threshold: 50%, rounded up, minimum 3 and maximum 200.
resetOnHealthyTaskdefaults to true.- Monitor
SERVICE_DEPLOYMENT_FAILEDthrough EventBridge and inspectrolloutStateReasonwithDescribeServices.
Trap: An alarm already in
ALARMat deployment start causes ECS to ignore the alarm configuration for that deployment.
The circuit breaker marks the rolling deployment failed when its task-failure threshold is reached.
With rollback enabled and a completed deployment available, ECS returns to that deployment.
Da documentação da AWS (17)
- The ECS deployment circuit breaker detects rolling deployments that cannot reach a stable running state.
- The ECS deployment circuit breaker is an ECS-controller feature rather than a CodeDeploy deployment control.
- The first circuit-breaker stage counts tasks that fail to reach RUNNING.
- After a task reaches RUNNING, the circuit breaker evaluates load balancer, Cloud Map, and container health-check failures.
- The default BOUNDED_PERCENT threshold is 50% of the latest desired count, rounded up and bounded from 3 to 200.
- resetOnHealthyTask defaults to true and resets failures when a task becomes healthy; false accumulates failures.
- UNBOUNDED_PERCENT uses a percentage threshold without the default lower and upper bounds.
- COUNT uses a fixed number of task failures as the threshold.
- With rollback enabled, the circuit breaker chooses the most recent COMPLETED deployment.
- Without a COMPLETED deployment to use, circuit-breaker rollback stalls and launches no new tasks.
- DescribeServices exposes rolloutState and rolloutStateReason; failed deployments stop launching new tasks.
- ECS sends deployment state-change events to EventBridge, including SERVICE_DEPLOYMENT_FAILED.
- Deployment alarms can fail an ECS deployment when a specified CloudWatch alarm enters ALARM and can optionally trigger rollback.
- When circuit breaker and alarms are enabled together, either can fail the deployment; rollback depends on that triggering method having rollback enabled.
- If an alarm is already in ALARM at deployment start, ECS ignores the deployment alarm configuration for that deployment.
- Native ECS blue/green supports circuit-breaker failure detection and rollback.
- The October 2026 VPC Lattice launch documents circuit-breaker rollback for native blue/green, linear, and canary deployments.
Native traffic shifting
Native ECS traffic shifting runs an old revisionAn updated runtime release within a Fargate platform version., blue, beside a replacement revision, green. It lets you test green before moving production requests and retain blue for rollbackReturning an application deployment to a previous revision after a problem..
How it works
- Choose a deployment strategy under the
ECScontroller.CODE_DEPLOYandEXTERNALare separate controllers. - Configure traffic routing through an ALB, NLB, Service Connect, or VPC Lattice. With an Application Load Balancer (ALB), a listenerA load balancer endpoint that accepts requests on a configured protocol and port. rule chooses a target groupA logical set of destinations that receive routed load balancer traffic., a set of destinations for requests. Configure primary and alternate groups and an ECS infrastructure roleAn assumable identity that supplies temporary credentials for allowed AWS operations. for load balancer management.
- Start green alongside blue. An optional test listener sends validation requests to green before production moves.
- Shift production using the selected strategy. A lifecycle hookA deployment action that runs custom validation or pauses at a selected stage. runs custom Lambda checks or pauses until
ContinueServiceDeploymentresumes the deployment. - Keep blue running during deployment bake timeA waiting period used to observe a new revision before deployment proceeds or old tasks end., the observation period after production has moved. With an ALB, rollback can send traffic back to blue. Terminate blue after successful completion.
| Strategy | Change |
|---|---|
ROLLING |
Replace tasks in batches; default strategy |
BLUE_GREEN |
Validate green, then switch production to it |
LINEAR |
Move production in equal increments |
CANARY |
Move a fraction, wait, then move the remainder |
Native blue/green launched in July 2025; native linear and canary followed in October 2025. NLB linear/canary support arrived in February 2026, pause controls in May 2026, and VPC Lattice traffic shifting in October 2026. A headless blue/green service, one without a traffic-routing integration, replaces tasks without ECS-managed traffic shifting.
Exam cues
- If the question says validate ECS green with test requests first, think blue/green and a test listener, because production can stay on blue during testing.
- If the question says equal traffic increments, think linear, because each step increases exposure by the configured amount.
- If the question says a small trial followed by the rest, think canary, because it has an initial production trial.
Remember
- The canary configuration defaults to 5% and a 10-minute canary wait.
- CloudFormation defaults native blue/green, linear, and canary deployment bake time to 15 minutes when omitted.
CODE_DEPLOYandEXTERNALdo not support this property. - Running both revisions consumes overlapping capacity; linear deployments can temporarily double usage.
Trap: The NLB all-at-once restriction belongs to CodeDeploy ECS deployments. Native ECS has its own traffic-shifting strategies.
Production initially routes to blue; an optional test listener can validate green.
ECS moves production to green and retains blue during deployment bake time for rollback.
Da documentação da AWS (23)
- The ECS controller supports ROLLING, BLUE_GREEN, LINEAR, and CANARY; ROLLING is the default strategy.
- CodeDeploy and EXTERNAL remain separate deployment controller options.
- Native blue/green runs an old blue service revision alongside a new green revision before directing production traffic to green.
- LINEAR shifts production traffic to the new service revision in equal percentage increments.
- CANARY sends a configured fraction of production traffic to the new revision, waits, then sends the remainder.
- CanaryConfiguration defaults to canaryPercent 5.0 and canaryBakeTimeInMinutes 10.
- ALB, NLB, Service Connect, or VPC Lattice can provide traffic shifting for native deployment strategies.
- With an ALB, native blue/green uses primary and alternate target groups plus a production listener rule.
- An optional test listener can route validation traffic to green before production traffic moves.
- ECS needs an infrastructure IAM role to manage load balancer resources for native traffic shifting.
- Deployment bake time retains both revisions after production traffic has shifted, before old tasks are terminated.
- CloudFormation defaults BakeTimeInMinutes to 15 for blue/green, linear, and canary when omitted.
- CODE_DEPLOY and EXTERNAL do not support the ECS BakeTimeInMinutes property.
- Lifecycle hooks can invoke Lambda or pause a deployment; a pause resumes through ContinueServiceDeployment.
- Linear deployments keep both revisions running during deployment and can temporarily double resource usage.
- During native ALB blue/green deployment, rollback can route traffic back to the old target group.
- A CodeDeploy ECS deployment with an NLB supports only CodeDeployDefault.ECSAllAtOnce.
- Native ECS blue/green deployments launched in July 2025.
- Native ECS linear and canary deployments launched in October 2025.
- Native ECS linear and canary support for Network Load Balancers launched in February 2026.
- Native ECS traffic shifting through VPC Lattice launched in October 2026.
- ECS pause and continue deployment controls launched in May 2026.
- A headless native blue/green service replaces blue tasks with green tasks without ECS-managed traffic shifting.
ECS scaling and credentials
Amazon ECS operations depend on capacity provider settings, external instance credentials, and service scaling controls. Understanding these settings helps diagnose tasks that cannot start and scaling that behaves differently during deployments.
How it works
- ECS compares
CapacityProviderReservationwithtargetCapacityto manage instance capacity. The metric is instances needed divided by running instances, multiplied by 100. Above target, ECS scales out; below target, it can scale inRemove tasks or instances when less capacity is needed.. - A capacity provider strategyRules defining how tasks are distributed among available capacity providers. distributes tasks by relative weightA relative share of tasks assigned to a capacity provider after satisfying its base. after meeting the baseA minimum task count placed on one provider before weighted task distribution.. At least one weight must be positive. An omitted weight defaults to 1 in the console but 0 in the API or CLI. Strategy item, Auto Scaling groupA collection of EC2 instances whose count can change to provide the needed capacity. capacity providers
- On an ECS Anywhere external instance, the Systems Manager Agent holds IAM credentials. They rotate every 30 minutes and refresh after a lost connection is restored.
- During an ECS deployment, service scale-in pauses while scale-outAdd tasks or instances to handle more work. continues unless suspended. This behavior does not apply to
EXTERNALcontrollers.RegisterScalableTargetcan suspend dynamic scale-in or scale-out usingDynamicScalingInSuspendedandDynamicScalingOutSuspended.
Exam cues
- If the question says tasks wait for new EC2 hosts, think about
targetCapacity, because its default of 100% can leave tasksPENDINGuntil instances register. - If the question says managed scaling stopped after an Auto Scaling group change, check
AmazonECSManaged, competing desired-capacity policies, andMaxSize, because each can prevent ECS from managing or adding capacity. Cluster auto scaling, Auto Scaling group capacity providers - If the question says a CLI strategy has no positive weights, set one above 0, because omitted CLI weights default to 0.
- If the question says dynamic scale-out must pause during a deployment, think explicit suspension, because scale-out normally continues.
Remember
targetCapacitydefaults to 100%, and the Auto Scaling groupMaxSizemust exceed 0 for scale-out. Cluster auto scaling, Auto Scaling group capacity providers- Managed termination protection requires instance scale-in protection and protects instances with non-daemon tasks from scale-in.
- ECS Anywhere credentials rotate every 30 minutes.
Trap: An omitted capacity provider weight does not have the same default everywhere: it is 1 in the console and 0 in the API or CLI. A strategy needs at least one positive weight. Auto Scaling group capacity providers, Strategy item
Da documentação da AWS (12)
- CapacityProviderReservation equals instances needed divided by running instances, multiplied by 100.
- targetCapacity defaults to 100%; above target ECS scales out, while below target it can scale in.
- At targetCapacity 100%, new tasks can wait PENDING for new instances to register.
- Removing the AmazonECSManaged Auto Scaling group tag prevents ECS from managing scaling.
- Do not add competing scaling policies that manage desired capacity on an ECS managed Auto Scaling group.
- The Auto Scaling group MaxSize must exceed 0 to allow scale-out.
- Managed termination protection requires Auto Scaling instance scale-in protection and protects instances with non-daemon tasks from scale-in.
- Strategy weight controls relative task distribution after base; at least one provider must have positive weight.
- An omitted weight defaults to 1 in the console and 0 in the API or CLI.
- The SSM Agent on an ECS Anywhere external instance holds IAM credentials that rotate every 30 minutes and refresh after a lost connection is restored.
- During ECS deployments, scale-in is suspended and scale-out continues unless suspended; this exception does not apply to EXTERNAL controllers.
- RegisterScalableTarget can suspend dynamic scaling with DynamicScalingInSuspended and DynamicScalingOutSuspended.
Flashcards
Nada para revisar aqui agora. Escolha outros tópicos ou outro filtro.
·
Todos os 76 flashcards em lista
How do an ECS task definition, task, and service differ?
Definition: container configuration. Task: an instance of it. Service: maintains the desired task count. Fargate supports REPLICA, not DAEMON.
An ECS service task is stopped with StopTask, but another task appears. Why?
The service replaces stopped tasks to maintain its desired count. StopTask stops a task; it does not reduce the service desired count.
A nightly container job on ECS must finish and exit. How should it run?
Use an EventBridge Scheduler schedule to launch a standalone task. A continuously maintained service is suited to long-running work.
How do you prepare a container image for an ECS task definition?
Write a Dockerfile, build and run the image locally, tag it with the ECR repository URI, and push it. Reference the image in the task definition.
Two Linux ECS tasks on Fargate must share files after either task is replaced. Which storage fits?
Use an EFS volume. It provides shared persistent storage; the container writable layer is disposable. Fargate Linux requires platform version 1.4.0 or later.
An ECS application needs file operations on data held in an S3 bucket. Which volume option fits?
Use S3 Files with s3filesVolumeConfiguration. Configure a task IAM role; encryption in transit is mandatory.
Will an EBS volume attached to an ECS service task automatically preserve application data after that task ends?
No. EBS volumes attached to service tasks are ephemeral. Standalone-task volumes can persist; EFS is shared persistent file storage.
Which load balancer should an ECS Fargate HTTP service use for application routing?
Use an Application Load Balancer. Fargate also supports Network Load Balancers for TCP/UDP and Gateway Load Balancers for virtual appliances.
An ECS Fargate service is configured with an instance-type load balancer target group. What should change?
Use ip targets. Fargate tasks require awsvpc networking and have their own network interfaces. Classic Load Balancers are unsupported.
Does replacing an ECS container preserve changes made to the image layers or its writable layer?
Image layers are read-only. The container writes into its own disposable layer; those changes do not survive replacement. Store persistent data in an appropriate external volume.
How can an ECS task definition guarantee that every task runs the exact same image, even if a tag is moved?
Reference the image by digest (repository@sha256:...) instead of by tag.
Why do containers start faster and use fewer resources than virtual machines?
Containers share the host operating system kernel; a virtual machine runs a full guest operating system.
An ECS application must read S3 objects using its own AWS permissions. Which role needs access?
The task IAM role. It provides the application credentials and uses ecs-tasks.amazonaws.com in its trust policy.
Which ECS role authorizes a Fargate image pull from ECR and awslogs delivery?
The task execution role. Start with AmazonECSTaskExecutionRolePolicy; add permissions needed for referenced secrets or other features.
An ECS Fargate container starts but its application receives S3 AccessDenied. Which role should you inspect?
Inspect the task role and applicable S3 policies. Successful startup does not prove the application has S3 permissions.
An ECS Fargate task injects a Secrets Manager secret at startup and reads S3 at runtime. Which roles need permissions?
Execution role: secretsmanager:GetSecretValue and kms:Decrypt if a customer managed key is used. Task role: the application S3 permissions.
An EC2 instance cannot register with its ECS cluster. Which IAM role should be checked?
Check the container instance role and instance profile. The ECS agent uses them for registration; the task role is for application calls.
Which principal should an ECS EC2 container instance role trust, and which managed policy can it use?
Trust ec2.amazonaws.com and use AmazonEC2ContainerServiceforEC2Role as the managed policy. Task roles instead trust ecs-tasks.amazonaws.com.
An ECS task definition injects a Parameter Store parameter encrypted with a customer managed KMS key. What execution-role permissions are needed?
ssm:GetParameters and kms:Decrypt. Add secretsmanager:GetSecretValue if the parameter references a Secrets Manager secret.
An ECS Fargate task must pull a private non-AWS image using credentials stored in Secrets Manager. What configuration and permissions are needed?
Set repositoryCredentials in the task definition and grant the execution role secretsmanager:GetSecretValue. Add kms:Decrypt for a customer managed key.
An ECS team wants to restrict task-role trust against confused deputy access to its account. Can aws:SourceArn be restricted to one ECS cluster?
No. Use aws:SourceAccount or a wildcard ECS aws:SourceArn; a specific cluster is not supported.
An application running in an Amazon ECS task needs AWS API permissions. Which role should carry them?
Use the task IAM role. It supplies temporary AWS credentials to application code in the task.
An ECS service injects a Secrets Manager secret into container environment variables. How can the service pick up a rotated secret?
Force a new service deployment to launch fresh tasks. Existing containers do not automatically refresh the injected value.
An Amazon ECS task injects a Secrets Manager secret encrypted with a customer managed KMS key. What permissions are needed?
The execution role needs
secretsmanager:GetSecretValueandkms:Decrypt.Which IAM role lets the Amazon ECS agent register an EC2 container instance and call ECS APIs?
The EC2 container instance role, attached through an instance profile.
ECS tasks on EC2 with the awslogs driver send no logs, and the task has no execution role. Which role needs logs:PutLogEvents?
The container instance role (or the task execution role, if one is assigned). The task role is for the application's own calls.
An ECS service image tag points to a newly pushed image. How should the service adopt it?
Force a new deployment. ECS establishes updated digests for replacement tasks; running tasks keep their image.
What do minimumHealthyPercent and maximumPercent control during an ECS rolling deployment?
The healthy task floor, rounded up, and the RUNNING/PENDING task ceiling, rounded down, relative to desiredCount. The settings must permit a task to start or stop.
An ECS REPLICA service must retain its healthy task count while replacing tasks. Which deployment settings apply?
minimumHealthyPercent 100 keeps the healthy floor at desiredCount; maximumPercent 200 allows another desiredCount of tasks when capacity is available. These are the REPLICA defaults.
An ECS Fargate service should adopt a different platform version. Will increasing desiredCount do it?
No. Update the service platform version and create a deployment. Scale-out alone uses the version selected for the current deployment, with its latest patched revision.
How can an ECS Fargate service replace running tasks to receive a newer revision of its selected platform version?
Force a new deployment. New tasks use the latest revision of the selected platform version; existing tasks keep their runtime revision.
How can an ECS service scale its task count automatically?
Use Application Auto Scaling with target tracking, step, scheduled, predictive, or SQS backlog-per-task scaling. A minimum capacity of 0 permits scale to zero.
An ECS worker service processes SQS messages with variable backlog. What scaling metric fits?
Use a custom backlog-per-task metric so capacity responds to queued work per worker.
An ECS service has CPU and memory target tracking policies. CPU requires scale-out but memory does not. What happens?
The service can scale out when either policy requests it. Scale-in requires agreement from all target tracking policies with scale-in enabled.
An ECS target tracking metric has insufficient data. Will ECS interpret that as low load and remove tasks?
No. Target tracking takes no scaling action for insufficient metric data.
An ECS EC2 service scales out but tasks remain pending for host resources. What capacity control is needed?
Use an Auto Scaling group capacity provider with managed scaling, and check its MaxSize and task fit. Service auto scaling changes task count; the capacity provider supplies hosts.
An ECS Fargate Spot service cannot obtain capacity. Will Fargate automatically run those tasks on demand?
No. Fargate does not automatically replace Spot capacity with on-demand capacity. Spot tasks receive a two-minute warning when interrupted.
An ECS team needs spare EC2 hosts so tasks can start without waiting for instance launches. What setting helps?
Set capacity provider targetCapacity below 100% to retain spare instance capacity.
How does an ECS capacity provider strategy use base and weight?
Meet the single provider base first, then distribute tasks by relative weights. Base defaults to 0, and at least one provider needs positive weight.
How should an ECS task that repeatedly stops be diagnosed?
Read service events, then DescribeTasks stopCode, stoppedReason, container reason, and exitCode. Inspect application logs and EC2 agent/runtime logs when relevant.
An ECS task writes logs to STDOUT and STDERR. How can those streams reach CloudWatch Logs?
Set each container logConfiguration to use awslogs and configure its destination and permissions. The driver forwards the streams directly.
An ECS service uses a custom EC2 AMI and cannot place tasks using awslogs. What host configuration should be checked?
Advertise awslogs in ECS_AVAILABLE_LOGGING_DRIVERS when starting the ECS agent. Also check log delivery permissions.
An Amazon ECS container stopped unexpectedly. Which task details help diagnose the failure?
Use DescribeTasks to inspect the stopped reason and stop code, plus the container reason and exit code.
An ECS task must send container logs to an external logging destination. Which routing feature fits?
Use FireLens with Fluent Bit or Fluentd. ECS starts the log router before dependent application containers by default.
An ECS operations team needs an alert containing why a task stopped. What event should it capture?
Match ECS Task State Change events with STOPPED status in EventBridge and send them to SNS. Read stoppedReason and stopCode.
An ECS task-state event has no task health field. How should health be retrieved?
Use DescribeTasks. Task health is not included in task state-change events.
Must an ECS team install a separate CloudWatch Logs agent to send container STDOUT and STDERR to CloudWatch?
No. Configure awslogs in the container logConfiguration; the Docker logging driver forwards those streams. File logs may need a sidecar or another collection method.
An ECS Fargate task fails with CannotPullContainerError. Which checks come first?
Confirm the image exists, the task execution role can pull it, and the task can reach the registry. EC2 image pulls use the container instance role.
An ECS task exits with OutOfMemoryError. What does that indicate?
The application may have exceeded its configured memory allocation, or host operating-system constraints caused the exit. Compare usage with the task definition and host limits.
An ECS task cannot retrieve an injected secret and reports ResourceInitializationError. What should be inspected?
Check the secret exists, the execution role has retrieval permissions, and the task can reach the secret service. Read the specific initialization message before changing permissions.
An operator needs a shell in a new ECS Fargate task without opening inbound SSH. Which feature and permissions are required?
Enable ECS Exec for the task and grant the task role the required ssmmessages control and data channel permissions. ECS Exec uses Systems Manager Session Manager.
An ECS Fargate task has a read-only root file system and ECS Exec fails. What constraint explains the failure?
The Systems Manager agent requires a writable container file system. ECS Exec commands run as root, and readonlyRootFilesystem is unsupported.
A private ECS task uses VPC endpoints and cannot establish an ECS Exec session. Which endpoint is required, and what is the session idle timeout?
Provide the ssmmessages interface endpoint. Add a KMS endpoint when using a KMS encryption key. ECS Exec has a fixed 20-minute idle timeout.
After a force new deployment that reuses the same image tag, some ECS tasks on EC2 container instances still run the previous image. What explains it?
The default pull behavior: when the remote pull fails, the agent starts the task from the cached local image. Setting ECS_IMAGE_PULL_BEHAVIOR to always makes the task fail instead, and a new tag per release avoids the ambiguity.
A company wants to run containerized batch jobs on its own on-premises servers but manage them from the same Amazon ECS control plane as its cloud tasks. Which feature fits?
Amazon ECS Anywhere, which registers on-premises servers as external instances in an ECS cluster.
Can an ECS service on ECS Anywhere external instances sit behind an Application Load Balancer?
No. Service load balancing isn't supported for external instances, so they suit outbound or data processing workloads.
An ECS rolling release must automatically recover when replacement tasks cannot start. What should be enabled?
Enable the deployment circuit breaker with rollback. It uses the latest COMPLETED deployment and is supported for ECS rolling updates.
How does the ECS deployment circuit breaker detect task failures by default?
It checks startup and then health-check failures. The default threshold is 50% of desired count, rounded up and bounded from 3 to 200. Healthy tasks reset the failure count by default.
An ECS rolling deployment fails with circuit-breaker rollback enabled, but no deployment is COMPLETED. What happens?
The deployment stalls without launching new tasks. Use deployment failure events to trigger investigation.
An ECS rolling deployment needs a fixed failure threshold rather than a percentage. Which circuit-breaker option fits?
Set thresholdConfiguration.type to COUNT. Enable rollback to return to the latest COMPLETED deployment when the threshold is reached.
When should an ECS rolling service use the circuit breaker versus CloudWatch deployment alarms?
Circuit breaker: startup and task health failures. Alarms: application metric degradation. Both may be enabled; either can fail the deployment.
An ECS rolling release must catch tasks that cannot start and latency increases after startup. Which controls should it use?
Use the circuit breaker and a CloudWatch deployment alarm for latency. Enable rollback on each method that must recover automatically.
An ECS deployment begins while its configured CloudWatch alarm is already ALARM. Will ECS monitor that alarm during this deployment?
No. ECS ignores the deployment alarm configuration for that deployment.
An ECS deployment must count intermittent failures even when healthy tasks start between them. Which setting should change?
Set resetOnHealthyTask to false. The default true resets the failure counter when a task becomes healthy.
Can an ECS native blue/green service use the ECS deployment circuit breaker for rollback?
Yes. Native blue/green setup supports circuit-breaker failure detection and rollback. It is not limited to the ROLLING strategy; CodeDeploy is a separate controller.
Which deployment strategies can the ECS controller run without CodeDeploy?
ROLLING, BLUE_GREEN, LINEAR, and CANARY. ROLLING is the default. CodeDeploy and EXTERNAL are separate controllers.
An ECS release must test a new revision before production traffic reaches it. Which deployment approach fits?
Use native blue/green with test traffic routing. Blue stays available while green is tested; deployment bake time retains blue after production shifts.
How can an ECS native deployment retain the old revision and run custom validation?
Set deployment bake time and lifecycle hooks. Hooks invoke Lambda or pause until ContinueServiceDeployment is called. CloudFormation defaults the native traffic strategies to 15 minutes of bake time.
An ECS team wants a small production trial followed by shifting all remaining traffic. Which strategy fits?
CANARY. Its canary configuration defaults to 5% traffic and a 10-minute canary wait; this wait is separate from deployment bake time.
An ECS service must increase production exposure in equal increments. Which deployment strategy fits?
LINEAR. Configure the traffic increment and wait between steps. Both revisions run during the deployment.
An ECS service uses CodeDeploy with a Network Load Balancer. Can it use a CodeDeploy canary deployment configuration?
No. That controller and load balancer combination supports only CodeDeployDefault.ECSAllAtOnce. Do not transfer that restriction to native ECS strategies.
How does ECS managed scaling decide to add EC2 instances?
It compares CapacityProviderReservation, instances needed / running instances x 100, with targetCapacity. The default target is 100%; tasks can wait while hosts register.
Which configuration changes can break ECS managed Auto Scaling group scaling?
Removing AmazonECSManaged, adding competing desired-capacity policies, or setting MaxSize to 0. Managed termination protection also requires instance scale-in protection.
An ECS capacity provider strategy created through the CLI omits every weight and tasks fail to launch. What should change?
Set at least one weight greater than 0. API and CLI weights default to 0, while the console defaults to 1.
How do Amazon ECS Anywhere external instances get AWS credentials?
Through the SSM Agent, which holds IAM credentials rotated every 30 minutes.
Does ECS service auto scaling continue during a deployment?
Scale-in pauses; scale-out continues unless suspended. This behavior excludes EXTERNAL controllers. RegisterScalableTarget can suspend dynamic scale-out explicitly.