private String getElastiCacheEndpoints(String clusterId) {
AmazonElastiCacheClient elastiCacheClient = new AmazonElastiCacheClient(new BasicAWSCredentials(awsAccessKey, awsSecretKey));
DescribeCacheClustersRequest request = new DescribeCacheClustersRequest();
request.setCacheClusterId(clusterId);
request.setShowCacheNodeInfo(true);
DescribeCacheClustersResult result = elastiCacheClient.describeCacheClusters(request);
List<String> endpoints = new ArrayList<String>();
if (result != null) {
for (CacheCluster cacheCluster : result.getCacheClusters()) {
for (CacheNode node : cacheCluster.getCacheNodes()) {
endpoints.add(node.getEndpoint().getAddress() + ":" + node.getEndpoint().getPort());
}
}
}