Amazon Web Services (AWS) Elastic Kubernetes Service (EKS) - List Clusters using the AWS CLI

by
Jeremy Canfield |
Updated: October 28 2023
| Amazon Web Services (AWS) Elastic Kubernetes Service (EKS) articles
Both the AWS CLI and the eksctl CLI can be used to list your Elastic Kubernetes Service (EKS) Clusters.
- aws eks list-clusters (this article)
- eksctl get clusters
The aws eks list-clusters command can be used to list your Elastic Kubernetes Service (EKS) Clusters.
~]$ aws eks list-clusters
{
"clusters": [
"my-cluster"
]
}
This will use the default profile in your hidden AWS credentials file (e.g. /home/john.doe/.aws/credentials). For example, if your hidden AWS credentials file has the following, the default credential would be used.
~]$ cat /home/john.doe/.aws/credentials
[default]
aws_secret_access_key = ABCDEFG123456789ABCDEFG123456789ABCDEFG12
aws_access_key_id = ABCDEFG123456789ABCD
Or, the --profile flag could be used to use some other profile in your hidden AWS credentials file.
~]$ aws eks list-clusters --profile johndoe
{
"clusters": [
"my-cluster"
]
}
And then the aws eks describe-cluster command can be used to display more information about the cluster.
~]$ aws eks describe-cluster --name my-cluster
{
"cluster": {
"name": "my-cluster",
"arn": "arn:aws:eks:us-east-1:123456789012:cluster/my-cluster",
"createdAt": "2023-10-24T14:51:38.002000-05:00",
"version": "1.27",
"endpoint": "https://DCFVCFVFD1111222233DDD.gr7.us-east-1.eks.amazonaws.com",
"roleArn": "arn:aws:iam::123456789012:role/eks/my-cluster",
"resourcesVpcConfig": {
"subnetIds": [
"subnet-11122233344455566",
"subnet-22233344455566677",
"subnet-33344455566677788"
],
"securityGroupIds": [
"sg-123456789abcdefg"
],
"clusterSecurityGroupId": "sg-987654321abcdefg",
"vpcId": "vpc-99988877766655544",
"endpointPublicAccess": false,
"endpointPrivateAccess": true,
"publicAccessCidrs": []
},
"kubernetesNetworkConfig": {
"serviceIpv4Cidr": "172.20.0.0/16",
"ipFamily": "ipv4"
},
"logging": {
"clusterLogging": [
{
"types": [
"api",
"audit",
"authenticator"
],
"enabled": true
},
{
"types": [
"controllerManager",
"scheduler"
],
"enabled": false
}
]
},
"identity": {
"oidc": {
"issuer": "https://oidc.eks.us-east-1.amazonaws.com/id/DCFVCFVFD1111222233DDD"
}
},
"status": "ACTIVE",
"certificateAuthority": {
"data": "LS0t.....tLS0K"
},
"platformVersion": "eks.6",
"tags": {
"Environment": "Development"
}
}
}
Did you find this article helpful?
If so, consider buying me a coffee over at