aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-west-2.amazonaws.comCommon first step before pushing or pulling private ECR images.
AWS CLI ECR and ECS commands for repositories, image login and cleanup, clusters, services, task definitions, and tasks.
Container registry workflows in Amazon ECR.
aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 123456789012.dkr.ecr.us-west-2.amazonaws.comCommon first step before pushing or pulling private ECR images.
aws ecr create-repository --repository-name my-appECR repositories store container images and support lifecycle rules.
aws ecr describe-repositoriesUseful for registry inventory scripts.
aws ecr list-images --repository-name my-appUseful before cleanup or tagging operations.
aws ecr describe-images --repository-name my-appUseful for release inventory and stale image cleanup.
Remove images from a repository by tag or digest.
aws ecr batch-delete-image --repository-name my-app --image-ids imageTag=old-releaseUseful in cleanup jobs and lifecycle tooling.
Attach a lifecycle policy document to a repository.
aws ecr put-lifecycle-policy --repository-name my-app --lifecycle-policy-text file://lifecycle-policy.jsonAutomates cleanup of old images based on age or tag rules.
Amazon ECS cluster, service, and task definition commands.
aws ecs list-clustersUseful for cluster inventory and discovery scripts.
aws ecs describe-clusters --clusters my-clusterUseful for checking capacity providers and service connect settings.
aws ecs create-cluster --cluster-name my-clusterStarting point for ECS service deployments.
aws ecs list-services --cluster my-clusterUseful for service inventory and automation loops.
Inspect ECS service desired count, task definition, and deployment status.
aws ecs describe-services --cluster my-cluster --services my-serviceGood first stop when troubleshooting ECS rollouts.
Restart service tasks using the current task definition.
aws ecs update-service --cluster my-cluster --service my-service --force-new-deploymentUseful after a new image tag is made available in-place.
Remove an ECS service after scaling it down or forcing deletion.
aws ecs delete-service --cluster my-cluster --service my-service --forceUse with caution in production environments.
Register task definitions and run or inspect tasks.
Create or update an ECS task definition revision from JSON.
aws ecs register-task-definition --cli-input-json file://taskdef.jsonTask definitions describe containers, CPU, memory, networking, and IAM roles.
aws ecs list-task-definitions --family-prefix my-appUseful for release and revision inventory.
aws ecs run-task --cluster my-cluster --task-definition my-app:12 --launch-type FARGATE --network-configuration 'awsvpcConfiguration={subnets=[subnet-0123456789abcdef0],securityGroups=[sg-0123456789abcdef0],assignPublicIp=ENABLED}'Useful for batch jobs, one-offs, and manual diagnostics.
aws ecs list-tasks --cluster my-clusterUseful for operational inventory and loops.
aws ecs describe-tasks --cluster my-cluster --tasks arn:aws:ecs:us-west-2:123456789012:task/my-cluster/0123456789abcdefUseful for finding stop reasons, ENIs, and exit codes.
aws ecs stop-task --cluster my-cluster --task arn:aws:ecs:us-west-2:123456789012:task/my-cluster/0123456789abcdef --reason 'manual stop'Useful in incident response and manual cleanup.