为何执行aws ecs describe-clusters命令无法查看集群详情?
Why
aws ecs describe-clusters can't find your ECS cluster (even though it shows up in the console)? Let's break down the most common reasons and fixes for this mismatch:
1. Your AWS CLI is targeting a different region than the console
The console shows your cluster in us-east-2, but your AWS CLI might be configured to use a different default region.
- Check your current CLI region with:
aws configure get region - If it's not
us-east-2, either update your default config withaws configure(set region tous-east-2), or explicitly specify the region in your command:aws ecs describe-clusters --region us-east-2
2. You're referencing the wrong cluster name/ARN
The error mentions the default cluster is missing, but maybe the cluster you see in the console has a different name.
- First, list all clusters in your target region to confirm the actual names/ARNs:
aws ecs list-clusters --region us-east-2 - Then use the correct cluster name/ARN in your describe command:
aws ecs describe-clusters --clusters your-cluster-name --region us-east-2
3. The IAM identity used by your CLI lacks permissions
You might be using a different IAM user/role in the CLI compared to the AWS console. The console's identity has access to view clusters, but the CLI's identity doesn't have the ecs:DescribeClusters permission.
- Check which identity your CLI is using:
aws sts get-caller-identity - Verify that this IAM entity has a policy that allows the
ecs:DescribeClustersaction (either for all clusters or your specific cluster ARN).
4. Rare case: AWS CLI cache or service inconsistency
Occasionally, temporary caching or service delays can cause this. Try:
- Re-running the command with the
--no-cli-pagerflag (to avoid any pager-related issues) - Clearing the AWS CLI cache (delete the
~/.aws/cli/cachedirectory if you're on Linux/macOS, or the equivalent on Windows)
内容的提问来源于stack exchange,提问作者Jon Sud
相关产品推荐
相关产品推荐

