Boto EKS Code Example
Jump to navigation
Jump to search
External
Internal
List Clusters
Lists the Amazon EKS clusters in the AWS account in the specified region.
import boto3
client = boto3.client('eks')
cluster_names = []
max_results = 10
response = client.list_clusters(maxResults=max_results)
next_token = response.get('nextToken')
cluster_names.extend(response.get('clusters'))
while next_token:
response = client.list_clusters(maxResults=max_results, nextToken=next_token)
cluster_names.extend(response.get('clusters'))
next_token = response.get('nextToken')
for cn in cluster_names:
print(cn)