"aws ecs describe-clusters" doesn't return the cluster

Viewed 3494

In the AWS Console, I created a cluster, task definition and repository for deploying my docker image. Then I created an IAM user and tried to list the clusters I have by calling

aws ecs describe-clusters

It returns me

{
    "clusters": [], 
    "failures": [
        {
            "reason": "MISSING", 
            "arn": "arn:aws:ecs:us-east-1:XXXXXXXXXXX:cluster/default"
        }
    ]
 }

Listing clusters also returns me empty array,

aws ecs list-clusters

Any help on this would be appreciated.

6 Answers

Execute

aws configure

Adjust "Default region name:" and execute again

aws ecs list-clusters

Perhaps a bit late and I hope it helps somebody.

First you need to list your clusters

$ aws ecs list-clusters
{
    "clusterArns": [
        "arn:aws:ecs:<aws_region>:<accn_id>:cluster/cumbancha-cluster"
    ]
}

Then, grab the cluster name from the previous output (in this case cumbancha-cluster) and try describe-clusters command again

$ aws ecs describe-clusters --cluster cumbancha-cluster
{
    "clusters": [
        {
            "clusterArn": "arn:aws:ecs:<aws_region>:<accn_id>:cluster/cumbancha-cluster",
            "clusterName": "cumbancha-cluster",
            "status": "ACTIVE",
            "registeredContainerInstancesCount": 1,
            "runningTasksCount": 3,
            "pendingTasksCount": 0,
            "activeServicesCount": 3,
            "statistics": [],
            "tags": [],
            "settings": [
                {
                    "name": "containerInsights",
                    "value": "disabled"
                }
            ],
            "capacityProviders": [],
            "defaultCapacityProviderStrategy": []
        }
    ],
    "failures": []
}

The above error suggest that the script is not able to load your default profile. It is always a good practice to add your profile and region to the script. I am assuming here that you have already did the configuration by "aws configure" cli command. Below is the snippet:

aws ecs describe-clusters --profile <YOUR-PROFILE> --region <AWS-REGION>

You can find the profile in the /.aws/config file.

One thing other answers missed is the fact that describe-clusters expects that cluster with name default exits if no cluster is specified. You can have as many clusters as you want but the error will show up if you don't specify the one you want to view.

As others pointed out you may need to specify correct region value (using aws configure, --region param, AWS_REGION env variable...). If you already did then perhaps resources were created in wrong region in aws web console?

I ran into this issue as well. The solution:

  • the describe-clusters command requires an input parameter --cluster in order to find the cluster in the way that you're calling it.

First, run aws ecs list-clusters to get your cluster(s) name.

Second, run aws ecs describe-clusters --cluster [cluster-name]

Provide the ecs cluster that you would like to describe in place of cluster-name.

(Assuming your region, profile, aws cli are configured correctly)

try

aws ecs describe-services --services <service_name> --cluster <cluster_name> --region <region_name>
Related