Bootstrap FreeKB - Amazon Web Services (AWS) Elastic Container Service (ECS) - List EC2 Instances using the AWS CLI
Amazon Web Services (AWS) Elastic Container Service (ECS) - List EC2 Instances using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

The aws ecs list-clusters command can be used to list your Elastic Container Service (ECS) Clusters.

~]$ aws ecs list-clusters
{
    "clusterArns": [
        "arn:aws:ecs:us-east-1:123456789012:cluster/my-ecs-cluster"
    ]
}

 

And then the aws ecs list-container-instances command can be used to list the EC2 Instances that have been registered in the cluster. In this example, there is one EC2 Instance registered in the ECS cluster.

~]$ aws ecs list-container-instances --cluster arn:aws:ecs:us-east-1:123456789012:cluster/my-ecs-cluster
{
    "containerInstanceArns": [
        "arn:aws:ecs:us-east-1:123456789012:container-instance/my-ecs-cluster/296c9008473948f89c8b2398c914bf0b"
    ]
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 51bd0f in the box below so that we can be sure you are a human.