`ResourceInitializationError: unable to pull secrets or registry auth: ... AccessDeniedException: User: arn:aws:sts::111111111111:assumed-role/ecsTaskExecutionRole/... is not authorized to perform: secretsmanager:GetSecretValue`.
IntermediateTroubleshootingECS, EKS, ECR and Lambda
Answer
Likely causes → The task definition refers to a secret in secrets, but the execution role (not the task role) cannot read it, or cannot decrypt the KMS key behind it. Network reachability to Secrets Manager or SSM can also cause this error.
Diagnose →
aws ecs describe-task-definition --task-definition api:42 \
--query 'taskDefinition.[executionRoleArn,containerDefinitions[].secrets]'
aws iam simulate-principal-policy --policy-source-arn arn:aws:iam::111111111111:role/ecsTaskExecutionRole \
--action-names secretsmanager:GetSecretValue --resource-arns <secret-arn>
Fix → Add secretsmanager:GetSecretValue (or ssm:GetParameters) on the specific secret ARNs, plus kms:Decrypt on the CMK, to the execution role. If the tasks are in private subnets, add the secretsmanager endpoint.
Prevent → Keep one execution role per service, scoped to its own secret paths, and remember: the execution role is for the agent, the task role is for your code.
More on ECS, EKS, ECR and Lambda
`docker push 111111111111.dkr.ecr.us-east-1.amazonaws.com/api:1.4` fails with `no basic auth credentials` (or `denied: Your authorization token has expired. Reauthenticate and try again.`).BeginnerFargate tasks stop with `CannotPullContainerError: pull image manifest has been retried 5 time(s): failed to resolve ref ... dial tcp 52.x.x.x:443: i/o timeout`.IntermediateA task stops with `Essential container in task exited`, exit code 137, and reason `OutOfMemoryError: Container killed due to memory usage`.BeginnerThe ECS service event says `service api was unable to place a task because no container instance met all of its requirements. The closest matching container-instance ... has insufficient memory available.`IntermediateAn ECS deployment rolls back automatically, and the event says `deployment failed: tasks failed to start` from the circuit breaker.Advanced`aws ecs execute-command` fails: `The execute command failed because execute command was not enabled when the task was run or the execute command agent isn't running.`Intermediate