Python program to list the details of all the redshift clusters across all regions.

__author__ = 'Amal G Jose'
import boto
class GetRedShiftDetails(object):
def __init__(self):
self.aws_access_key = "XXXXXXXX"
self.aws_secret_key = "XXXXXXXX"
##Method for getting the details of RedShift Clusters
def get_redshift(self, region):
try:
host_name = 'redshift.' + region + '.amazonaws.com'
redshift_conn = boto.connect_redshift(aws_access_key_id=self.aws_access_key,
aws_secret_access_key=self.aws_secret_key,
region=region,
host=host_name)
clusters = redshift_conn.describe_clusters()
cluster_details = clusters['DescribeClustersResponse']['DescribeClustersResult']['Clusters']
for cluster in cluster_details:
print cluster['ClusterIdentifier'], str(cluster['NumberOfNodes']), cluster['NodeType'], region
except Exception, e:
print "Exception occurred while reading redshift cluster details " + str(e)
if __name__== '__main__':
regions = ['ap-southeast-1', 'ap-southeast-2', 'ap-northeast-1',
'us-east-1','us-west-1', 'us-west-2','eu-west-1', 'sa-east-1']
get_details = GetRedShiftDetails()
for region in regions:
get_details.get_redshift(region)